If we want to retain some attribute values across multiple pages which is a better approach -
1. Declare the required formbean attributes as static. 2. Put the formbean into session scope.
I have a list of records showing on Page1, when user clicks on any record, a few parameters are passed to targetted action class. I do not want those parameters to be displayed in URL query string. Also I feel its not a good practice to keep entire record list in session.
Please suggest.. Will it help to keep the records as static arraylist in formbean.
Session. If it's static and your application has more than one user wouldn't that lead to issues? Static members are per class, not per instance.
Mohit Jain
Ranch Hand
Joined: Jun 04, 2007
Posts: 74
posted
0
Thanks for your response David. Well if we put entire list of records in session is it a good practice? Please suggest what kinda problems may be encoutered following this.
It can lead to large sessions if the collections are very large; in those cases you should only return a page's worth of results and re-query on pagination.
Whether or not it's a "best practice" depends on the situation, really.