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/11/18 18:32:01 UTC

Setting up a form in an action

I am trying to do this sequence of events:

1) setupProductForm.do?isin=abcd

2) This creates a productForm instance, and initialises the product, based
on the given ISIN

3) persistProduct - This should save the product

What happens at the moment is my form is my setupProductForm action
correctly loads the product, and sets it on the form:

            productForm.setTradeProduct(tradeProduct);

On success, I forward to 'success', which maps to productForm.jsp

 
The action in productForm is persistProduct

When I submit this form, in the validate() method I output the tradeProduct
to the console - this confirms that a new form has been created, and the
attributes persisted from the values in the form.

This wouldn't be a problem, but I have a productID, which is not in the
form, and I don't think it should be. For that reason, it's just the default
'-1' I set it to in the static intialiser.

Do I have to have unseen attributes as hidden fields in the JSP, and why? 

My struts-config entry for these two actions is:

    <!-- 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"
           validate="true">
      <forward name="success"
path="/sourcefiles/dealinfo/productForm.jsp"/>
    </action> 

Any ideas why this is happening, or how I should get around it?

Thanks

Marcos

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