Thursday, 15 May 2014

java ee - What is a best practice to pass data from Action to view(jsp) in Struts 1.3.? -



java ee - What is a best practice to pass data from Action to view(jsp) in Struts 1.3.? -

i writing web application in struts 1.3. want pass arraylist of employees jsp page.

i see next 2 approches :

1. set list of employee field actionform.

list<employee> employees;

action class setting field:

empform.setemployees(employeelist);

and jsp using info :

${empform.employees}

2. set list of employees straight request.

action class setting employeelist request.

request.setattribute("employees", employeelist);

and in jsp:

${employees}

please suggest approach should go with. 1 considered practice in struts 1.3.

both correct. if page required form can set list in actionform. prefer setting within actionform since more organized.

jsp java-ee web-applications struts struts-1

No comments:

Post a Comment