Win a copy of Java Challengers this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

request object

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ajil sa
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

I will try Hidden field for storing objects.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic