wood burning stoves 2.0*
The moose likes Struts and the fly likes Communication between Actions classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Communication between Actions classes" Watch "Communication between Actions classes" New topic

Communication between Actions classes

Navi Lock
Ranch Hand

Joined: Jul 29, 2003
Posts: 39
Folks, need some guidance on the below..

Have 2 action classes. Ex: Action1.java and Action2.java.

Action 2 has its form validated as 'DynaValidator' extension and has a corresponding Jsp.

Can Action1 pass on control to Action2 bypassing the Validation of Action2 ?

Want Action2 to execute different logic based on where the request comes from.

Action2 can get request from the Jsp or another Action class.
So if the request from's from Action1 execute some functions and
if the request comes from Jsp execute some other functions

Is the above possible ? an example would be great.

Thanks in advance,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
See this link on how to chain actions.

If you want validation to occur under one circumstance and not another, I'd suggest you create two separate action mappaings both pointing to the same Action class, one specifying validate="true" and the other validate="false". In the Action class, you can tell how the action was invoked by calling the getPath method of the ActionMapping instance that is passed into the execute method as a parameter.

Consultant, Sima Solutions
Navi Lock
Ranch Hand

Joined: Jul 29, 2003
Posts: 39
Hi Merrill,

cool.. think that would work..

Let me try..

Thanks for the help...appreciate it.

subject: Communication between Actions classes
Similar Threads
does a new action context created for every new action in struts2
forwarding request to an action from a jsp page
how can I make two actions communicate with each other
putting a value in request scope in struts2 from jsp
Sending a List to another Action class