Error in deploying struts: Attribute name invalid according to t

Discussions

Web tier: servlets, JSP, Web frameworks: Error in deploying struts: Attribute name invalid according to t

  1. Hi guys..

    This is my first post in this site.

    I am deploying my first struts application.
    I got held up at an exception.

    I am including the details here:

    my root directory is C:\jakarta-tomcat-4.1.30
    I created a directory by name "struts" in webapps.
    (C:\jakarta-tomcat-4.1.30\webapps\struts)
    I created the directory "web-inf" and index.jsp is my first view.

    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF.
    C:\jakarta-tomcat-4.1.30\webapps\struts\index.jsp

    I copied all the jar files from C:\jakarta-struts-1.2.4\lib to
    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\lib\

    __________________________________________________________________________
    index.jsp:

    <%@ page language="java" %>
    <%@ taglib
    uri="/WEB-INF/struts-html.tld"
    prefix="html" %>
    <html>
    <head>
    <title> First Struts Application</title>
    </head>

    <body>
    <table width="500" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td height="68" width="48%">
    <div align="left">
    <img src="images/Cloud.gif">
    </div>
    </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    </table>

    <html:form action="Lookup" name="lookupForm"
    type="first.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>

    </body>
    </html>
    _______________________________________________________________________

    I included the following in web.xml:
    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\web.xml

    <!-- Struts Tag Library Descriptors -->
    <taglib>
    <taglib-uri>
    /WEB-INF/struts-html.tld
    </taglib-uri>
    <taglib-location>
    /WEB-INF/struts-html.tld
    </taglib-location>
    </taglib>

    I copied struts-html.tld from C:\jakarta-struts-1.2.4\lib to
    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\


    ActionForm and Action :
    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\classes\first
    LookupAction.java
    (Package first contains 2 classes :LookupAction and LookupForm)
    __________________________________________________________________________
    package first;

    import java.io.IOException;
    import javax.servlet.ServletException;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;

    public class LookupAction extends Action
    {

    protected Double getQuote(String symbol)
    {

    if(symbol.equalsIgnoreCase("SUNW"))
    {
    return new Double(25.00);
    }

    return null;
    }

    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException,ServletException
    {
    Double price=null;
    String target=new String("success");

    if(form!=null)
    {
    LookupForm lookupForm=(LookupForm)form;
    String symbol=lookupForm.getSymbol();
    price=getQuote(symbol);
    }

    if(price==null)
    {
    target=new String("failure");
    }
    else
    {
    request.setAttribute("PRICE",price);
    }

    return (mapping.findForward(target));
    }

    }

    class LookupForm extends ActionForm
    {

    private String symbol=null;

    public String getSymbol()
    {
    return (symbol);
    }

    public void setSymbol(String symbol)
    {
    this.symbol=symbol;
    }

    public void reset(ActionMapping mapping,HttpServletRequest request)
    {
    this.symbol=null;
    }

    }
    ___________________________________________________________________________
    I compiled the above java file. The corresponding class files are in
    C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\classes\first\

    The struts-config.xml contains :
    (C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\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>

    <form-beans>
    <form-bean name="lookupForm"
    type="first.LookupForm"/>
    </form-beans>


    <action-mappings>

    <action path= "/Lookup"
    type="first.LookupAction"
    name="lookupForm" >
    <forward name="success" path="/quote.jsp"/>
    <forward name="failure" path="/index.jsp"/>
    </action>

    </action-mappings>

    </struts-config>
    ______________________________________________________________________

    The second view is quote.jsp

    ___________________________________________________________
    <html>
    <head>
    <title>First Struts Application</title>
    </head>
    <body>

    <table width="500"
    border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td height="68" width="48%">
    <div align="left>
    <img src="images/wxmainlogowhitespace.gif">
    </div>
    </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td>
    Current Price: <%=request.getAttribute("PRICE") %>
    </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    </table>
    </body>
    </html>
    ____________________________________________________

    Finally the web.xml file has :
    ________________________________________________________
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
    2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

    <web-app>

    <!-- Standard ActionServlet Configuration -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>WEB-INF/struts-config.xml</param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Standard ActionServlet Mapping -->
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- Standard Welcome File List -->
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <!-- Struts Tag Library Descriptors -->
    <taglib>
    <taglib-uri>
    /WEB-INF/struts-html.tld
    </taglib-uri>
    <taglib-location>
    /WEB-INF/struts-html.tld
    </taglib-location>
    </taglib>

    </web-app>

    ___________________________________________________________________________

    Now when i try to open the index page, by
    http://localhost:8080/struts/

    i am getting the following error:

    HTTP Status 500 -

    --------------------------------------------------------------------------------

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: /index.jsp(30,0) Attribute name invalid according to the specified TLD
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186)
    at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:498)
    at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:707)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
    at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
    at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
    at org.apache.jasper.compiler.Validator.validate(Validator.java:607)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:230)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)



    --------------------------------------------------------------------------------


    I guess i have done everything perfect.
    Can anyone help me out from this exception?

    Thanks in advance,

    Rajani.
  2. type, name?[ Go to top ]

    Can you see type and name attributes in tld (struts 1.2.4) below?
    No you can not.
    That is the problem.


    <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>
  3. Hi Velja,

    Thankyou.
    I got it..

    I removed the name and type attributes from <html:form>

    Now i am a getting a new exception.


    HTTP Status 500 -

    --------------------------------------------------------------------------------

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: Exception creating bean of class first.LookupForm: {1}
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)


    root cause

    javax.servlet.ServletException: Exception creating bean of class first.LookupForm: {1}
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:95)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)



    --------------------------------------------------------------------------------

    Apache Tomcat/4.1.30

    Waiting for a faster reply,

    Rajani.
  4. I do not know why you missed package declaration and imports. I can not read this whole page again now (i am in mess now). If this is not the problem go to http://www.reumann.net/struts/lesson1.do and see how to make your struts app.

    <IMPORTANT>package first;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;</IMPORTANT>

    class LookupForm extends ActionForm
    {

    private String symbol = null;

    public String getSymbol()
    {
    return (symbol);
    }

    public void setSymbol(String symbol)
    {
    this.symbol = symbol;
    }

    public void reset(ActionMapping mapping, HttpServletRequest request)
    {
    this.symbol = null;
    }

    }
  5. I do not know why you missed package declaration and imports. I can not read this whole page again now (i am in mess now). If this is not the problem go to http://www.reumann.net/struts/lesson1.do and see how to make your struts app.

    <IMPORTANT>package first;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;</IMPORTANT>

    class LookupForm extends ActionForm
    {

    private String symbol = null;

    public String getSymbol()
    {
    return (symbol);
    }

    public void setSymbol(String symbol)
    {
    this.symbol = symbol;
    }

    public void reset(ActionMapping mapping, HttpServletRequest request)
    {
    this.symbol = null;
    }

    }
  6. There is a problem with the version of struts here. The book you are using is talking about struts 1.1 while the version you probably have installed is struts 1.2.4 (which is the latest stable version available at the moment). the <html:form > tag in the newer version does not require the explicit maping to the class definition. It uses the struts-config.xml for mapping purposes.

    Removing the name and type attributes from the form tag solves the problem.
    I am using j2sdk version:1.4.1_05, struts version:1.2.4 and tomcat version:5.0.12.
  7. if you don't mind, can i ask you how are you developing your application? are you using any IDE? which web server and database server are you using?
    has your problem solved yet?

    thnx
  8. I am also having similar troubles with deploying struts. I am playing around with James Goodwill/R. Hightower book on Jakarta Struts and got stuck. After I have done everything according to the book I get the following error when I try to deploy:

    HTTP Status 500 -

    type Exception report

    message
    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:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:101)
    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)


    root cause

    javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
    org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
    org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:119)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:90)
    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)
    ----------------------------------------------------------

    I hope someone out there could help me. I have checked the codes, there has been no reference to ActionMappings (emphasise the "s"), only ActionMapping in the java codes and <action-mappings> in the config code.
  9. try to check your config file, like struts-config
  10. Hi rajani,

    When building your struts application try to use IDE envirionment like JBuilder,WebSphere etc. Thereby you can rectify the errors soon.

    In this problem domain,the problem seems to be in TLD file.
    In jakarta-struts directory you might have some ".war" files.Extract the file and copy the tld files alone and place it in your dir.stp the webservice and start it again.

    The Attribute name you mention should match exactly in the config files.Check for the names.

    It is better to follow a sample application development from web.

    I followed the same application in IDE and i got correct.

    Thanks,
    Shivanandham.K
  11. Hi,

    You did a small mistake.Dont remove the type and name attributes from <html:form> in index.jsp

    They denote the action form and what action should take for the particular actionform bean.

    DO:

    1. Copy the struts-html.tld file from webapps/struts-blank.war file.

    2.Replace the change that you made in index.jsp.Place the type and name attribute as it is in example.

    check for the XXXForm.java and XXXXAction.java program that whatever method you invoke should match the keyword.

    Ex. SetUsername,GetUsername.
    I hope so now you will overcome the problem.

    Thanks,
    Shivanandham.K
  12. Tomcat[ Go to top ]

    Thanks
  13. the problem is with the version incompatibility with Tomcat.

    removing the "name" and "type" tag will solve the issue as pointed out.
  14. As suggested on the forum i removed the name & type attribute from <html:form> tag but it results in the following error
    Cannot retrieve mapping for /Lookup action
  15. Solution for your problem.[ Go to top ]

    Hi Man,
    I think the solution given by previous person was 100% correct. I did the same thing i.e. deleting the name & type attributes from the <action> tag. Just verify your struts-config. Try to check the spelling mistake if u did...

    my struts-config.xml looks like this :
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <struts-config>
    <form-beans>
    <form-bean name="lookupForm" type="ch03.LookupForm" />
    </form-beans>


    <action-mappings>
    <action path="/Lookup" type="ch03.LookupAction" name="lookupForm">
    <forward name="success" path="/quote.jsp" />
    <forward name="failure" path="/index.jsp" />
    </action>
    </action-mappings>
    </struts-config>

    Your problem of not "Cannot retrieve mapping for /Lookup action" is only the configuration type mistake that u might have done in your struts-config.xml..

    Let me know in case your stil your problem persist.


    Important :
    The declaration of <html:form> in index.jsp <html:form action="Lookup"> must match with

    <action path="/Lookup" type="ch03.LookupAction" name="lookupForm"> coding of struts-config.xml.

    Try to check action="Lookup" must be same with <action path="/Lookup">.