I am writing a web application in struts 1.3 . I want to pass ArrayList employees to the JSP page.
I see the following two statements:
1. Place the employee list as a field in ActionForm.
List<Employee> employees;
The action class that defines this field:
empForm.setEmployees(employeeList);
And JSP using this data as:
${empForm.employees}
2. Put the list of employees directly in the request.
A class action that sets employeeList to the request.
request.setAttribute("employees", employeeList);
And in JSP:
${employees}
Please suggest with what approach I should go. Which one is considered good practice in Struts 1.3.
source share