Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
es kranthi
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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('');
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic