This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

get/set attribute

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Action class and it forwards to a jsp. I set a Object in request scopt and obtain it in jsp and again set it to request scope. Now in jsp i have a button, when clicked this goes to another Action Class. I am not able to get the object from request. it is always null.

-Rang
 
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ranga S",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Bear Bibeault
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ranga S:

I have a Action class and it forwards to a jsp. I set a Object in request scopt and obtain it in jsp and again set it to request scope. Now in jsp i have a button, when clicked this goes to another Action Class. I am not able to get the object from request. it is always null.



That is correct. The request goes out of scope when the response is returned to the client.

I suggest reading this article for a better understanding of the life-cycle of a JSP request.
 
Rang Sar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please tell me is there any solution to this ?
 
Bear Bibeault
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ranga S", my request that you adjust your display name was not a suggestion. Valid display names are a requirement for participation on the JavaRanch. Please re-read my request and change your display name prior to your next post.

bear
JavaRanch Sheriff
[ January 28, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

To persist a scoped variable across multiple requests, one means is to place the scoped variable into session scope rather than request scope.

When doing so, take care to "clean up" after yourself as sessions only go out of scope when they timeout, so you may end up with a lot of wasted memory if you aren't careful with session data.
 
Rang Sar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
Without putting to session is there any way where I can manage with requests only ?
 
Bear Bibeault
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could propogate the values by writing them as hidden elements in the page's form so that they will be re-submitted on the next request.

That's more work and means everything needs to be serialized to string values.
 
    Bookmark Topic Watch Topic
  • New Topic