You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Scriven, Marcos" <Ma...@gs.com> on 2001/12/05 11:32:58 UTC

Problem with setting up a form and scope

I have a product form, which I load in the following way:

1) request setupProductForm.do?isin=AB123456789X&action=0
2) This then runs the setup product action - it loads the product according
to the given ISIN, and sets the action
3) At the end of the action, I put in the following code:

        if ("request".equals(mapping.getScope())) {
            request.setAttribute(mapping.getAttribute(), productForm);
        }
        else {
        	HttpSession session = request.getSession();
            session.setAttribute(mapping.getAttribute(), productForm);
        }

I took this from the example app

4) This forwards on to productForm.jsp

Unfortunately, I keep getting the following exception:

javax.servlet.jsp.JspException: No bean found under attribute key
productForm
        at
org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.java:
222)

The only way I've been able to get rid of this is by changing the scope to
session - however, I really don't need it on the session, and don't really
want to be responsible for cleaning it up after use.

The salient parts of my strut-config are:

  <form-beans>

    <!-- Product form bean -->
    <form-bean      name="productForm"
                    type="com.gs.ficc.cderiv.web.ProductForm"/>

  </form-beans>

  <action-mappings>
   
    <!-- Setup Product Form -->
    <action    path="/sourcefiles/dealinfo/setupProductForm"
               type="com.gs.ficc.cderiv.web.SetupProductFormAction"
               name="productForm"
              scope="request"
           validate="false">
      <forward name="success"
path="/sourcefiles/dealinfo/productForm.jsp"/>
    </action>
    
    <!-- Persist Product -->
    <action    path="/sourcefiles/dealinfo/persistProduct"
               type="com.gs.ficc.cderiv.web.PersistProductAction"
               name="productForm"
               scope="request"
               input="/sourcefiles/dealinfo/persistProduct.jsp"
           validate="true">
      <forward name="success"
path="/sourcefiles/dealinfo/success.jsp"/>
    </action>
  </action-mappings>    

Any ideas what I'm doing wrong? Also, is there a simpler/cleaner way of
setting up a form?

Thanks

Marcos

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>