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?

Rgds/Gordon
gloginAsked:
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: http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts_p.html (Action chaining)
I personally, used the first one only.
0
 
TimYatesCommented:
return actionMapping.findForward( "nameofmapping" ) ;
0
 
gloginAuthor Commented:
Thank. In my case, I need to use the 2nd one. How to acheive it in coding?
0
 
aozarovCommented:
If you prefer to extends the RequestProcessor (which I personally didn't do) then you can have a look at:
http://www.onjava.com/lpt/a/5411
or
http://www.myeclipseide.com/PNphpBB2+file-printview-t-6693-start-0.html

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: http://struts.apache.org/api/org/apache/struts/action/RequestProcessor.html
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.
0
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.