struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Kovacs" <jonat...@nortelnetworks.com>
Subject RE: html:form frustration
Date Thu, 19 Sep 2002 19:34:59 GMT
Danny,

Isn't that what this section of my struts_config.xml is for? 

>  <form-beans>
>    <form-bean name="editForm"
>               type="test.web.editForm" />
>  </form-beans>

Jonathan


-----Original Message-----
From: Danny Mui [mailto:danny@muibros.com] 
Sent: Thursday, September 19, 2002 3:05 PM
To: Struts Users Mailing List
Subject: Re: html:form frustration


Looks like you're missing a form definition, lookup (the method causing 
the exception) is looking for the form bean when no name is specified in 
the field definition.

  <action path="/load"
            type="test.web.LoadAction"
-->         name="editForm" <----
            scope="request"
            validate="true">
      <forward name="continue"
               path="/jsp/edit.jsp">
      </forward>
    </action>

Hope that works!

danny

Jonathan Kovacs wrote:

>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(PageConte
>xtImp
>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.j
a
>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(ApplicationDispatc
h
>er.java:431)
>        at
>org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatche
r
>.java:355)
>        at
>org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.j
a
>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(Applicatio
n
>FilterChain.java:247)
>        at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
h
>ain.java:193)
>        at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
a
>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.j
a
>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:18
0
>)
>        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:17
0
>)
>        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.jav
a
>: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:112
5
>)
>        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.j
a
>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(ApplicationDispatc
h
>er.java:431)
>        at
>org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatche
r
>.java:355)
>        at
>org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.j
a
>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(Applicatio
n
>FilterChain.java:247)
>        at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
h
>ain.java:193)
>        at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
a
>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.j
a
>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:18
0
>)
>        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:17
0
>)
>        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.jav
a
>: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:112
5
>)
>        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
>
>
>  
>




--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


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