Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 Java Interview Guide this week in the Jobs Discussion 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: and

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.

I agree. Here's the link:
subject: Communication between Actions classes
It's not a secret anymore!