• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sustaining formbean attributes

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Is there any better way to do this??
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic