• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing values in Action Class

 
manikandan malathy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one problem in struts application please help me....
In my class have 2 action classes. One for searching some data and setting to request(request.setAttribut("Test",Test)).

But I am not getting these values in anohter action class... I am giving

request.getAttribute("Test");

But i am getting null values....
 
Vinoth Thirunavukarasu
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Sorry for command.Tell me clearly then only we can help you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the user makes a request to search for some data, there is an Action class that handles this request. What statement did you write for setting data in the request?
 
Alejandro Galvan
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes within a request just live in that request, so, if you are calling one of your action classes from (lets say) a jsp, and then it gets back to another page and from that second page you call another action class, it is a different request, so the the attribute in your first request is no present in the second one, the first one just died, if you want more life time to the objects you can set the attributes in the session scope, like:

but that is not a completelly smart way
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic