• 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

put request.Property value into bean

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This may be simple but...
I have a value passed to a servlet via a get i.e. ?item=value
I retrieve this value with request.getProperty(value);
but i want to put the value into a bean so as serveral other jsp's and servlets can retrieve it from that bean.
How do i do it?
Cheers
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For passing objects in request scope:
Object item = request.getAttribute("item");\
item = new Object("bla");
request.setAttribute( "item", item);
Session scope:
HttpSession session = request.getSession( true );
Object item = session.getAttribute("item");
item = new Object("bla");
session.setAttribute( "item", item);
There is also an servlet context wide scope if the
former two are not enough.
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the bean hasn't bean created, and you want it in the session scope:

I think that this is what you're looking for
 
dibs dibley
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,
Thats it!

Cheers
 
"To do good, you actually have to do something." -- Yvon Chouinard
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic