Hi,
Here is the sequence:
1: User fill up's "employeeForm.jsp" which have multiple text fields, radio
buttons, text area's and dropdowns.
2: On pressing "Submit" button in "employeeForm.jsp", "InsertEmployeeAction"
is called which do the following:
2.1) BeanUtils.copyProperties( employeeDTO, employeeForm)
2.2) DataBaseService.insertEmployee (employeeDTO)
2.3) return mapping.findForward("success");
Now, I want to call same "employeeForm.jsp" in "editable" mode, such that
all the fields (text fields, radio buttons, text area's and dropdowns) are
"pre-populated". What approaches are there to achieve this? I'm looking for
a way which uses same BeanUtils.copyProperties() and copy the employeeDTO
to employeeForm (Bean). Something like this:
When user click's "Edit Employee Form" link, an action
(EditEmployeeAction) will be called. Which will do the following:
1. Fetch the employee information from database in employeeDTO.
2. Get the "handle" of EmployeeForm (ActionForm), lets say "employeeForm"
3. BeanUtils.copyProperties(employeeForm, employeeDTO)
4. return mapping.findForward("editMode");
I'm not sure whether this approach will work or not? And whether I have to
make seprate JSP's for 1st time fill up (employeeForm.jsp) and edit mode (
employeeFormEdit.jsp). If this the case, then I guess, I've to make
EmployeeFormEdit.java (ActionForm) as well.
It will be great if anybody could help me here.
Thanks in advance.
Bye,
Viki.