我做了一个页面add.jsp
 <form method="post" name="Form_Add" id="Form_Add" action='<%=request.getContextPath()%>/sendDeclaration.do'">
<TABLE ><tr><td width="80" nowrap>内容</td>
<td><html:textarea property="textvalue"  cols="120" rows="40"></html:textarea>
</td>
</tr>
<tr><td width="80" nowrap>附件</td>
 <td colspan="2" align="center" valign="top" width="80">  <html:file property="File"></html:file> </td>
</tr>
 </Table>
 </form>
对应得FormBean:MessageBean.java
public class MessageBean extends ActionForm {
private String textvalue;
private FormFile File  ; //附件
public String getTextvalue() {
return textvalue;
}
public void setTextvalue(String textvalue) {
this.textvalue = textvalue;
}
public FormFile getFile() {
return File;
}
public void setFile(FormFile file) {
File = file;
}
}
配置文件:
<form-beans>
   <form-bean name="loginForm" type="com.ecode.login.LoginForm" />
     <form-bean name="messageForm" type="com.ecode.wdxx.MessageBean" />
  </form-beans>
    <action-mappings >
       <action path="/sendDeclaration" name="messageForm" scope="request" type="com.ecode.wdxx.SendDeclarationAction" validate="false">
      <forward name="send" path="/wdxx/send.jsp" />  
      <forward name="index" path="/grxx_index.jsp" />
       <forward name="error" path="/error.jsp" />  
    </action>    </action-mappings>
运行界面后:
javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
org.apache.struts.taglib.html.BaseHandlerTag.lookupProperty(BaseHandlerTag.java:945)
org.apache.struts.taglib.html.TextareaTag.renderData(TextareaTag.java:89)
org.apache.struts.taglib.html.TextareaTag.renderTextareaElement(TextareaTag.java:74)
org.apache.struts.taglib.html.TextareaTag.doStartTag(TextareaTag.java:51)
org.apache.jsp.wdxx.messageAdd_jsp._jspx_meth_html_textarea_0(messageAdd_jsp.java:336)
org.apache.jsp.wdxx.messageAdd_jsp._jspService(messageAdd_jsp.java:215)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.ecode.all.EncodingFilter.doFilter(EncodingFilter.java:26)
我换成<html:text>标签后就没有问题.好像事是对无法解析标签。不知道是什么原因。请帮帮忙,谢谢

解决方案 »

  1.   

    1。试图在Struts的form标记外使用form的子元素。在后面使用Struts的html标记等 
    2。不经意使用的无主体的标记,如web 服务器解析时当作一个无主体的标记,随后使用的标记都被认为是在这个标记之外的
    3。还有就是在使用taglib引入HTML标记库时,你使用的prefix的值不是html
    4。property必须和所要提交的action对应的formbean中的某个属性相匹配(必须有一个formbean)
    5。要使用标签,外层必须使用标签,不能使用html的