• 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

request.getAttribute

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am binding a value to the request object in my servlet using request.setAttribute. This servlet is forwarded to a jsp which contains several frames. Each frame has a jsp as its source. i want to access the value from the request object (request.setAttribute) in the jsp which is inside one of the frames. I tried it as follows :
MainServlet -> MainJsp. MainJsp contains 3 frames . These frames has Jsp1 Jsp2 and Jsp3 as its source respectively.
In my MainServlet :
request.setAttribute("AttributeName",AttributeValue)
In my Jsp1 :
request.getAttribute("AttributeName")
But it returns me NULL value. If i try to retreive it in MainJsp then i am able to get the correct Value .
Can anyone help me out.
THanks
Hariharan
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assempling the multiple parts of a frame takes multiple requests so your Jsp1 etc are seeing separate requests. You should put the value into the session - that will be visible from all JSP.
Bill
 
Sheriff
Posts: 67746
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
Welcome to the Ranch HariHaran!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first name followed by a last name separated with a space.
Thanks!
bear
JSP Fourm Bartender
 
reply
    Bookmark Topic Watch Topic
  • New Topic