你的tld文件中的属性名和你的表单中的属性名是一样的吗?

解决方案 »

  1.   

    如何判断是否一样?我是把struts1.2.4目录下的struts-html.tld拷贝到我的WEB-INF目录下的,index.jsp里代码是:
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
      

  2.   

    /index.jsp(34,1)
    你的34行是什么?
      

  3.   

    标签的属性名肯定是写错了。
    看一下struts-html.tld里面是怎么写的,要对上。
    写错的那个标签就在index.jsp的34行。
      

  4.   

    34行就是:
    <html:form action="Lookup" name="lookupForm" type="wiley.LookupForm">struts-html.tld内容很多,要和哪个对上?刚接触struts,不好意思
      

  5.   

    这些是从struts-html.tld中提取出来的,好像没有name属性啊!
    需要怎么该呢?
    <tag>
    <name>form</name>
    <tagclass>org.apache.struts.taglib.html.FormTag</tagclass>
    <bodycontent>JSP</bodycontent>
    <attribute>
    <name>action</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>acceptCharset</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>enctype</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>focus</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>focusIndex</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>method</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>onreset</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>onsubmit</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>scriptLanguage</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>style</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>styleClass</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>styleId</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>target</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
      

  6.   

    既然tld没有定义,就不能写
    把name="lookupForm"删掉
      

  7.   

    删掉以后就找不到FormBean了,错误如下
    type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
    org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
    org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:86)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    note The full stack trace of the root cause is available in the Tomcat logs.
      

  8.   

    你的formbean要在struts-config.xml和jsp页面上定义的。
      

  9.   

    定义过的
    struts-config.xml
    ------------------
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config
    PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts.config_1_1.dtd"><struts-config>
    <message-resources parameter="wiley.ApplicationResources"/>
    <form-beans>
    <form-bean name="lookupForm" type="wiley.LookupForm"/>
    </form-beans>
    <action-mappings>
    <action path="/Lookup"
    type="wiley.LookupAction"
    name="lookupForm"
    input="/index.jsp">
    <forward name="success" path="quote.jsp">
    <forward name="failure" path="index.jsp">
    </action-mappings>
    </struts-config>index.jsp
    ----------------------------
    <%@page language="java"%>
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    ...
    <html:form action="Lookup" name="lookupForm" type="wiley.LookupForm">
    <table width="45%" border="0">
    <tr>
    <td>Symbol:</td>
    <td><html:text property="symbol" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><html:submit/></td>
    </tr>
    </table>
    </html:form>
    ...
      

  10.   

    1、你的<html:form action="Lookup" name="lookupForm" type="wiley.LookupForm">
    修改成<html:form action="/Lookup">2、在你的action path里面加上这个formbean的有效范围,scope="request"。
    <action path="/Lookup"
    type="wiley.LookupAction"
    name="lookupForm"
             scope="request"
    input="/index.jsp">
      <forward name="success" path="quote.jsp">
      <forward name="failure" path="index.jsp">
    </action>
      

  11.   

    <html:form action="Lookup" name="lookupForm" type="wiley.LookupForm">
    把这里的name和type去掉试一下
      

  12.   

    chubbchubb(长街) 和ecaol(孤单北半球):你们的方法我试过了,结果都是
    ...
    javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
    ...就是第二次贴的那个错误信息
    :(
    是不是struts版本的问题啊,我用的是sturts1.2.4
    书上的例子是struts1.1的
    1.2.4中action标签没有name和type属性
    1.1的我下载不到,不知道是不是有<html:form action="Lookup" name="lookupForm" type="wiley.LookupForm">
    <html:form action="Lookup" >
    <html:form action="/Lookup" >
    <html:form action="Lookup.do">
    都试过了,都不行!
    第一中情况结果是:Attribute name invalid for tag form according to TLD
    后面三种情况结果是:ActionMappings or ActionFormBeans 我在struts-html.tld中加上name属性,运行错误是name没有setter方法,看来struts的action标签中确实没有name属性
    郁闷中...
      

  13.   

    能否给一个可以运行的实例参照一下(Struts1.2.4的),
    [email protected]
      

  14.   

    Struts1.2.4的例子,在他的src文件包里就有,不用另找。
    jakarta-struts-1.2.4-src\web\example