I meant toScope

-----Original Message-----
From: Ram Venkataswamy 
Sent: Wednesday, June 09, 2004 1:19 PM
To: Struts Users Mailing List
Subject: RE: Hoe to store objects in request scope

Did u try providing scope attribute for bean:define

-----Original Message-----
From: PADALA, SANDHYA (SBCSI) [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 09, 2004 9:05 AM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]
Subject: Hoe to store objects in request scope

Hi All,
      I have a question on how to save the objects into request scope.
In my Form class I have an array of objects of type Product.
My Product class has productId and productName as the variables with
getter setter methods.
On my JSP I use logic-iterate tag to iterate through the array and use
html:link tag to display URL with productname as the display name and
procuct Id as the URL query string to the link.
Now on my JSP , if there is a validation error, This part of code is
throwing error saying could not find the collection list , since these
objects are not stored in the request and not in the Form object.

How do I get around this problem. 
I cannot use hidden fields to store the product objects since they are
not string objects.

On my JSP
<logic:iterate id="products" name="TaskForm" scope="request"
                        type="com.foo.Product" property="productList"
indexId="idx">
<bean:define id="productID" name="products" property="productID" />
<%java.util.HashMap param = new java.util.HashMap();
param.put("productID", productID);
pageContext.setAttribute("parameter", param);
%>      
<html:link name="parameter" scope="page" page="/product.do"><FONT
COLOR="#000000">
<bean:write name="products" property="productName" filter="true" />
</html:link>
</logic:iterate>

My Form class
public class TaskForm extends WorkFlowForm {
                
        public Product[] productList;

        public Product[] getProductList() {
                return productList;
        }

        public void setProductList(Product product) {
                this.productList[index] = product;
        }
}

My Product class

public class Product {
        /** @modelguid {CB0A7F3C-BEF2-46FB-8217-785C38D51CFD} */
        public String productID;

        /** @modelguid {B1408FF2-A899-4D46-A785-3B34DDE5D3C9} */
        public String productName;

        /**
         * Returns the attID.
         * @return String
         */
        public String getProductID() {
                return productID;
        }

        /**
         * Returns the attName.
         * @return String
         */
        public String getProductName() {
                return productName;
        }

        /**
         * Sets the attID.
         * @param attID The attID to set
         */
        public void setProductID(String productID) {
                this.productID = productID;
        }

        /**
         * Sets the attName.
         * @param attName The attName to set
         */
        public void setProductName(String productName) {
                this.productName = productName;
        }

}

        


Can someone help me with this.
Thanks a lot for your help in advance.
Sandhya

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to