Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getAttribute

 
Hari Haran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!