File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Passing values in Action Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing values in Action Class" Watch "Passing values in Action Class" New topic

Passing values in Action Class

manikandan malathy

Joined: Sep 17, 2008
Posts: 13
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


But i am getting null values....
Vinoth Thirunavukarasu
Ranch Hand

Joined: Dec 18, 2008
Posts: 164

Sorry for command.Tell me clearly then only we can help you.

Java Best Practices
Linux Best Practices
Amortization Calculator

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.

[Asking smart questions] [About Bear] [Books by Bear]
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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

Joined: Jan 02, 2008
Posts: 48
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

SCJP 5.0<br />Preparing SCWCD
I agree. Here's the link:
subject: Passing values in Action Class
It's not a secret anymore!