I recently developed an application with a complex UI. One of the pages required 
querying the database based on user selection and re-displaying the page with the 
retrieved data and any previous existing user selections. Four different fields can 
trigger a db query resulting in page re-display and validations can also result in 
page re-display. Each time the page is re-displayed, the "state" of the page must be 
"remembered" from the last time it was displayed. (still with me so far?) Most of the 
data retrieved is list data displayed in single- or multi-select lists and populated 
using html:options collection and LabelValueBean. (for those of you reading this post 
who have developed similar code, you will know what I'm referring to).

In the action, the retrieved data is placed in session scope to minimize db hits. I 
thought this was a good idea at the time. For some reason, placing data in session 
scope is frowned upon by some members of my team (even if improves performance). 
Anyways, what I need are some ideas of the best practices that fellow Struts users 
follow when a page requires querying the db and re-displaying the page with the 
retrieved data and previous selections if placing the data in session scope is not an 
option. How can I recall the previously retrieved data without requerying the db? 
Would it make sense to hide the data in the page? (i.e. either using hidden fields or 
hidden select lists or to generate a JavaScript array). What are the risks, if any, of 
hiding the data in the page? (i.e. performance).

If anyone has developed similar pages, can you tell me if you decided for or against 
placing data in session scope and why?

Any ideas would be appreciated.

Thanks in advance.

Reply via email to