struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Kovacs" <jonat...@nortelnetworks.com>
Subject html:form frustration
Date Thu, 19 Sep 2002 18:40:01 GMT
Hi All,

I've been beating my head against this problem for a couple days now and
frankly, I'm stumped...

Using Struts 1.0.2, I'm attempting to display a select box which is filled
with a list of options loaded into the session context.  I've verified that
the options are loaded (using an <html:iterate> tag), but for some reason,
the instant I add an <html:form> tag to my .jsp, all hell breaks loose.  

The path my application follows is this:

/jsp/index.jsp --> /load.do --> /jsp/edit.jsp

The relevant sections of my struts-config.xml file:

<struts-config>

  <!-- ========== Form Bean Definitions ===================================
-->
  <form-beans>
    <form-bean name="editForm"
               type="test.web.editForm" />
  </form-beans>

  <!-- ========== Action Mapping Definitions ==============================
-->
  <action-mappings>
    <action path="/load"
            type="test.web.LoadAction"
            scope="request"
            validate="true">
      <forward name="continue"
               path="/jsp/edit.jsp">
      </forward>
    </action>
    <action path="/edit"
            type="test.web.EditAction"
            name="editForm"
            scope="request"
            input="/jsp/edit.jsp"
            validate="false">
      <forward name="cancel"
               path="/jsp/index.jsp">
      </forward>
      <forward name="continue"
               path="/jsp/edit.jsp">
      </forward>
    </action>
  </action-mappings>
</struts-config>

In edit.jsp:

<html:form action="/edit.do">
  <html:select property="name">
    <html:options collection="<%= Constants.DATA % >" property="label"/>
  </html:select>
</html:form>

The error:

javax.servlet.ServletException
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)
        at org.apache.jsp.edit$jsp._jspService(groups$jsp.java:312)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:683)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:431)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:355)
        at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:2199)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:2023)
        at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:540)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
        at java.lang.Thread.run(Thread.java:479)
14:25:35,791 ERROR [Engine] ----- Root Cause -----
javax.servlet.jsp.JspException
        at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:803)
        at
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
        at org.apache.jsp.edit$jsp._jspService(groups$jsp.java:199)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:683)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:431)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:355)
        at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:2199)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:2023)
        at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:540)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
        at java.lang.Thread.run(Thread.java:479)

I've looked at line 803 of FormTag.lookup and so far as I can tell, the
exception is thrown because the code gets a null from it's call to
FormBeans.findFormBean(String):

        // Look up the form bean definition
        ActionFormBean formBean =
            formBeans.findFormBean(mapping.getName());
        if (formBean == null) {
            JspException e = new JspException
                (messages.getMessage("formTag.formBean",
mapping.getName()));
            pageContext.setAttribute(Action.EXCEPTION_KEY, e,
                                     PageContext.REQUEST_SCOPE);
            throw e;
        }

        // Calculate the required values
        name = mapping.getName();       // <--- Line 803
        scope = mapping.getScope();
        servlet = mappings.getServlet();
        type = formBean.getType();

Any suggestions would be *greatly* appreciated!

Thanks,

Jonathan Kovacs


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message