How to retrieve the data(ArrayList) from JSP to Action Class
Hi Everyone,
Can somebody guide me how to retrieve my data with Arraylist and pass to my Action Class.
Here's the portion of my JSP code:
<logic:notEmpty name="dbRecordList" >
<logic:iterate id="list" name="dbRecordList">
<tr valign="top" >
<td width="80"><html:text name="payrollDetailForm" property="trnx_code"/></td>
<td width="80"><html:text name="list" property="employee_id"/></td>
<td width="80"><html:text name="list" property="sipc_company_code"/></td>
<td width="80"><bean:write name="list" property="lastname"/></td>
<td width="80"><bean:write name="list" property="firstname"/></td>
<td width="80"><bean:write name="list" property="mi"/></td>
<td width="100"><html:text name="payrollDetailForm" property="date_fr"/></td>
<td width="70"><html:text name="payrollDetailForm" property="date_to"/></td>
<td width="70"><html:text name="payrollDetailForm" property="ee_amount"/></td>
</tr>
<br class="clear"/>
</logic:iterate>
</logic:notEmpty>
Here's my Action Class:
/**
*
*/
package spcpayroll.trans.action;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import spchrm.dao.PIMBean;
import spcpayroll.dao.PayrollDetailDAO;
import spcpayroll.trans.form.PayrollDetailForm;
/**
* @author JMBalisacan
*
*/
public class PayDetailAddAction extends Action {
/* (non-Javadoc)
* @see org.apache.struts.action.Action#execute(org.apache .struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
ActionForward returnForward = null;
//Cast the form object argument to the
// action form corresponding to this class.
PayrollDetailForm f = (PayrollDetailForm)form;
//Instantiate the UserMaintDAO class for connecting to the DB.
PayrollDetailDAO payrollDetailDAO = new PayrollDetailDAO();
//ArrayList dbRecordList = (ArrayList)request.getSession(true).getAttribute(" dbRecordList");
ArrayList dbRecordList = (ArrayList)request.getSession(true).getAttribute(" dbRecordList");
for (int i = 0; i < dbRecordList.size(); i++) {
}
return mapping.findForward("success");
}
}
Any help is greatly appreciated.
Thanks
CESAR
|