• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to access request attributes in JSP

 
Mohd Asim
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am setting a request attribute in a JSP:



in the action class, I am setting the request attribute once again:

the mapping for that action is as follows:


now when i try to access that attribute in my index.jsp


It shows up as null in the JSP. is something worng with the code?

Thanks in advance!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohd,
In MVC, the JSP is the last thing that happens in a request. By the time you hit another action, the request is over and all your request attributes are gone. Which explains the null. Why not pass the value as a parameter to the action?
 
Mohd Asim
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you mean that when I am setting the attribute in JSP like this



as soon as the link is clicked (index), I lose that attribute? And that attribute would not be available to the Action invoked by the link?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic