Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using session or request, in Struts

 
Sean Li
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my app, I have some kind of jsp pages may be accessed from different entries, should I use session or request as the scope of form bean?

for instance, I have a order select screen. this page can be accessed from purchase order selection and sales order selection and etc. If I set the order select form bean into session, I will be in trouble if two order selection screen opened at the same time.

but if I don't set the form bean into session, and use request instead, it would be hard for me to remember the purchase order form bean or sales order form bean.

I'm sure most of you have the same problem, how did you handle it?
 
Andy Deighton
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"I will be in trouble if two order selection screen opened at the same time" - how would this be achieved? By opening two browsers? I thought by opening two browsers, you'd get two sessions, and your form bean would be safe.
Alternatively, you could keep your form bean as request scope, but put whatever other information you need in your session scope - this can then be accessed from your actions.

Andy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic