You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dorai, Harish (c)" <Ha...@tvratings.com> on 2001/03/05 15:38:24 UTC

Problems in accessing Form bean in the JSP page

Hi,

I wrote a small module using the Struts controller, to display the values
entered in an HTML form. My controller part works fine and is setting the
ActionForm bean with the form field values. But the JSP to which I forwarded
the request, is not able to access the form bean.  In the JSP I coded, as
follows:

<jsp:useBean="testForm" class="com.test.TestForm" scope="session">
</jsp:useBean>

In my struts-config.xml, I have 

<form-beans>
 

    <form-bean      name="testForm"
                    type="com.test.TestForm"/>
</form-beans>

<action-mappings>
    
    <action    path="/iterate"
               type="com.test.TestAction"
               name="testForm"
              scope="session"
           validate="false">
      <forward name="manager"              path="/manager.jsp"/>
      <forward name="employee"             path="/employee.jsp"/>
    </action>

  </action-mappings>

In the above example, both the forwarded JSPs are not able to access the
testForm bean. I am getting the following message.

<Mar 5, 2001 9:21:14 AM EST> <Error> <HTTP>
<[WebAppServletContext(469904,Iterat
eTest)] Servlet failed with Exception
weblogic.servlet.jsp.JspException: (line 11): testForm is not defined as
bean
        at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:619)

Am I missing something here?

Thanks,
Harish.