Struts and Action

Hi all

I am using Struts in my applicatin.
I prepare a MyAction which extends Action.

In the execute() method, I perform my business logic. Then I want to lookup the struts config again to find another actionpath, how to do so?

Who is Participating?
aozarovConnect With a Mentor Commented:
Are you trying to chain Actions by calling an Action from another Action?
This article has two aproaches for this: (Action chaining)
I personally, used the first one only.
return actionMapping.findForward( "nameofmapping" ) ;
gloginAuthor Commented:
Thank. In my case, I need to use the 2nd one. How to acheive it in coding?
If you prefer to extends the RequestProcessor (which I personally didn't do) then you can have a look at:

After you extends the class with your logic you can make struts use it by setting this entry
 <controller contentType="text/html:charset=UTF-8" locale="true" nocache="true" processorClass="<your_request_processorr"/>
in struts-config.xml

This is the RequestProcessor API:
And as you can see The Actions map is visible to you via the actions variable where the key is the fully qualified class name of the Action class.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.