Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carrying Bean through JSP

Status
Not open for further replies.

Exie

Programmer
Sep 3, 2003
156
AU
Hi,

I have an action, which populates a bean(eg. B1) and pops it into the request stack. My JSP then picks up and uses some of the data in B1 to draw up a form.

I want to then carry B1 into the next action. Can I pass this along like with a HTML Hidden tag ? or somehow pass a reference to B1 along in the query string ?

Would doing this be considered a bad practice ? I just wanted to avoid a second database hit if I could. I'm also hesitant to store B1 in the session scope as I want to avoid ending up with pages showing stale data.
 
Session scope is the only way I know how and I've found the 'gain' from saving data in the session to avoid future db hits is minimal at best..

I tend to make everything very request based. In my experience you may have to hit the DB again but if its not super duper intensive you won't even notice. The gain here is cleaner code, more encapsulated data and pure request cycle processing, no session access which is a life-saver in a multi-server environment.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top