This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes reuqest not being propagated to next page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "reuqest not being propagated to next page" Watch "reuqest not being propagated to next page" New topic
Author

reuqest not being propagated to next page

sridhar yenamandra
Greenhorn

Joined: Jul 27, 2004
Posts: 19
Hi ,

I have set an attribute in request scope in my jsp.On clicking button i go to another jsp where i am trying to retreive the attribute i set in the request. But here the value is null as if like no attribute is set.
Would appreciate any solution for this.

Thanks,
Sridhar.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Each round trip to the server creates a new HTTP request and hence a new request instance. Your first request goes out of scope when the response is returned to the client.

If you want data to persist across request boundaries, do not store it in the request.

Perhaps the session would be abetter place. If so, be sure to remove the data from the session when no longer required.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Parambir Singh
Ranch Hand

Joined: Sep 05, 2004
Posts: 40

On click of that button, instead of the simple url, use jsp:forward tag. that would use the same request object so your attribute will not be null later.


SCJP, SCMAD
http://parambir.me
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Param"
Thank you for changing your display anme, but it is still incorrect. Please read the following carefully:

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please correct your display name or your account will be deleted.

thanks,
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reuqest not being propagated to next page
 
Similar Threads
question on jsp:include
Request Attribute doubt?
Can I forward a local variable to another servlet?
Problem Setting Attribute from JSP
scope resolution in JSP