Hello,
i have one problem in retrieving updated data from textbox which in in iterate tag.
this code is in jsp page which is part of table:
<logic:present name="effortForm" property="activity" >
<bean:size id="size" name="effortForm" property="activity" />
<logic:greaterThan name="size" value="0">
<logic:iterate id="result" name="effortForm" property="activity">
<tr>
<td align="left"> <bean:write name="result" property="activityname" /></td>
<td><html:text name="result" property="day1" ></html:text></td>
<td><html:text name="result" property="day2" ></html:text></td>
<td><html:text name="result" property="day3" ></html:text></td>
<td><html:text name="result" property="day4" ></html:text></td>
<td><html:text name="result" property="day5" ></html:text></td>
<td><html:text name="result" property="day6" ></html:text></td>
<td><html:text name="result" property="day7" ></html:text></td>
</tr>
</logic:iterate>
</logic:greaterThan>
</logic:present>
<html:submit ><bean:message key="button.update"/></html:submit>
the form code(EffortForm):
private ArrayList activity=null;
private String activityname=null;
private int day1, day2, day3, day4, day5, day6, day7;
public ArrayList getActivity()
{
return activity;
}
public void setActivity(ArrayList act)
{
this.activity= act;
}
public String getActivityname()
{
return activityname;
}
public void setActivityname(String act)
{
this.activityname= act;
}
public int getDay1()
{
return day1;
}
public void setDay1(int day)
{
this.day1= day;
System.out.println("day1" + this.day1);
}
public int getDay2()
{
return day2;
}
public void setDay2(int day)
{
this.day2= day;
System.out.println("day2" + this.day2);
}
public int getDay3()
{
return day3;
}
public void setDay3(int day)
{
this.day3= day;
}
public int getDay4()
{
return day4;
}
public void setDay4(int day)
{
this.day4= day;
}
public int getDay5()
{
return day5;
}
public void setDay5(int day)
{
this.day5=day;
}
public int getDay6()
{
return day6;
}
public void setDay6(int day)
{
this.day6= day;
}
public int getDay7()
{
return day7;
}
public void setDay7(int day)
{
this.day7= day;
}
now i hav got two action for this jsp page:
1) one which is called before the jsp page loads to show data on page load
2) after i click update on jsp page
action 1:
i am retrieving from the db in form of arraylist and showing it on jsp page. this is working fine.
public class EffortLoadAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
EffortForm effortform=(EffortForm)form;
EffortDb effortdb=new EffortDb();
Connection conn=effortdb.getConnection();
effortform.setActivity(effortdb.getActivity(conn, effortform.getSdate()));
effortdb.closeConnection(conn);
return mapping.findForward("success");
}
}
action 2:
here i want to retrieve back the updated data from jsp page.
action 2 update code(EffortAction):
public ActionForward update(ActionMapping mapping,ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Exception
{
EffortForm effortform=(EffortForm)form;
EffortDb effortdb=new EffortDb();
Connection conn=effortdb.getConnection();
ArrayList list=effortform.getActivity();
Effort eff=new Effort();
for(int i=0;i<list.size();i++)
{
eff=(Effort)list.get(i);
System.out.println(i + "-" + eff.getActivityname() + " " + eff.getDay1() + " " + eff.getDay2() + " " + eff.getDay3() + " " + eff.getDay4()+ " " + eff.getDay5()+ " " + eff.getDay6()+ " " + eff.getDay7());
}
return mapping.getInputForward();
}
EffortDb and Effort are model class.
problem is in action2 ...when i do the necessary changes in the textbox and then click update, i am not getting the updated data of the textbox.
Please help asap.... how to get the updated changes on action page.
Thanks...