不知道为什么有些Struts很奇怪我原来的目的是显示一个下拉框,我就写了下面的代码:
<html:select   property="selected">                         
  <html:options   name="xxxForm"   property="values"   labelProperty="labels"/>            
</html:select>  结果运行后,提示:Cannot find bean under name org.apache.struts.taglib.html.BEAN
必须让我加一个from,那就加贝结果,我又增加了下面的代码:
<html:form  method="post" > <html:select   property="selected">                         
  <html:options   name="xxxForm"   property="values"   labelProperty="labels"/>            
</html:select>  </html:form>我以前项目中下面这样写没问题
<html:form  method="post" > </html:form>
但是现在项目中
<html:form  method="post" >
</html:form>
这样写就报错: According to the TLD attribute action is mandatory for tag form然后我加上了
<html:form  method="post" action="">
</html:form>
又报错: Cannot retrieve mapping for action /然后我写
<html:form  method="post" action="#">
</html:form>又报错:Cannot retrieve mapping for action /
非要我写一个存在的action才可以通过!这个action我根本用不上,我都是用js统一提交的,而且如果我只是想展示一个select还要写这么多无用的东西吗?
搞的我乱死了啊!别人放假我加班啊,还要跟struts这些无聊的东西斗争,哼哼74了!

解决方案 »

  1.   

    有表单了
    就得配置表单BEAN啊
      

  2.   

    使用<html:form>就必须要指定action。否则浏览网页时报错。但用<form>不指定action就可浏览网页。
      

  3.   

    既然用了Struts框架,当然要遵循它的一些规定,如果你不用标签它就不会提示要什么form,或者这类的错误了,如果你用了<html:form>,那就需要遵循它的规定,因为框架遇到此标签它就会去校验,然后翻译成普通的html
      

  4.   

     <html:form>必须指定action建议别使用struts标签,了解下就好了,
    多用jstl.
      

  5.   

    对啊,用Struts标签就必须有相应的action来相对应,你用的是Struts1.2吧,但是 Struts2可以不用配置action来相对应,如果写“#”的话,最多在MyEclipse里会出现这么一个警告:
     No configuration found for the specified action: '#' in namespace: ''. Form action defaulting to 'action' attribute's literal value.就是没有相对就原action来匹配,但不是错误
    可以试一下啊
      

  6.   

    用JSTL标签吧
    别用struts标签了