aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Communication between Actions classes" Watch "Communication between Actions classes" New topic
Author

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,
-Navi
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.


Merrill
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.

-Navi
 
Don't get me started about those stupid light bulbs.
 
subject: Communication between Actions classes