aspose file tools*
The moose likes Struts and the fly likes Cannot iterate over DynaValidator form or a form bean while retrieving records Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cannot iterate over DynaValidator form or a form bean while retrieving records" Watch "Cannot iterate over DynaValidator form or a form bean while retrieving records" New topic
Author

Cannot iterate over DynaValidator form or a form bean while retrieving records

es kranthi
Ranch Hand

Joined: Dec 27, 2010
Posts: 30
HI everyone this is my first post i wish you all a Happy new year.......

My issue is i am not able to iterate over a Dyna(OR) form bean while retriveing multiple records from database....
Records display show same values like if there are 4 records matching the query i am able to retrieve all the records but they are not being displayed uniquely although i have unique records being retrieved.... My code is as follows

ActionForm(i Ma not using MVC style for various puposes)
ResultSet rs = stmt.executeQuery(query);

if(rs.next())
{
do{
al=new ArrayList();
actionForm.set("product_ID", rs.getInt("product_ID"));
actionForm.set("product_Name", rs.getString("product_name"));
actionForm.set("company", rs.getString("company"));
actionForm.set("price", rs.getInt("price"));
actionForm.set("value", 1);
actionForm.set("totval", 1);
al.add(actionForm);

System.out.println("()()()()()()()()()"+al);
}while(rs.next());

}javascript:emoticon('');

form beanjavascript:emoticon('');
<form-bean name="DynaShopCartForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="product_ID" type="java.lang.Integer"></form-property>
<form-property name="product_Name" type="java.lang.String"></form-property>
<form-property name="company" type="java.lang.String"></form-property>
<form-property name="price" type="java.lang.Integer"></form-property>
<form-property name="value" type="java.lang.Integer"></form-property>
<form-property name="totval" type="java.lang.Integer" />
</form-bean>



Outputjavascript:emoticon('');



Product ID Product Name Company Price Quantity Total Price
2 Car Maruthi 100000 1 100000
2 Car Maruthi 100000 1 100000
2 Car Maruthi 100000 1 100000
2 Car Maruthi 100000 1 100000
2 Car Maruthi 100000 1 100000


Thank youjavascript:emoticon('');
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Cannot iterate over DynaValidator form or a form bean while retrieving records