aspose file tools*
The moose likes JSP and the fly likes request object 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 "request object" Watch "request object" New topic
Author

request object

Ajil sa
Greenhorn

Joined: Sep 30, 2008
Posts: 16
Hi friends,

I have two JSP pages (page1.jsp and page2.jsp)

I am creating an object named(obj1) of some calss on page1.jsp, storing it in request attribute, and forwarding to page2.jsp using jsp:forward action tag.

On page2.jsp I am fetching object obj1. Here I am able to fetch the obj1 successfully. Now my requirement is that , On page2.jsp on clicking of button I want to call page2.jsp and also want the request attribute which I set on page1.jsp.

I can do it using session or application scoped attribute, but how to do it using request attribute ?

Thanks in advance.


SCJP 5.0
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2713
    
    5

On page2.jsp on clicking of button I want to call page2.jsp and also want the request attribute which I set on page1.jsp.

And why are you calling page2.jsp cyclically ?

Anyways if you want a value to persists across requests, try using the session or using hidden form fields.


SCJP, SCWCD.
|Asking Good Questions|
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Once a request sends its response to the browser (so that a button can be pressed), the request is finished. So there is no way that you can have a request-scoped variable maintained across this action.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ajil sa
Greenhorn

Joined: Sep 30, 2008
Posts: 16
Thanks for the reply.

I will try Hidden field for storing objects.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request object
 
Similar Threads
HttpUnit - Urgent Help Required
actionForm mechanism
redirecting page
Navigating using a link
jsp page redirection