Struts and Action

Posted on 2005-04-13
Medium Priority
Last Modified: 2013-11-24
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?

Question by:glogin
  • 2
LVL 35

Expert Comment

ID: 13771388
return actionMapping.findForward( "nameofmapping" ) ;
LVL 15

Accepted Solution

aozarov earned 200 total points
ID: 13773709
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.

Author Comment

ID: 13778290
Thank. In my case, I need to use the 2nd one. How to acheive it in coding?
LVL 15

Expert Comment

ID: 13778664
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: 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.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month14 days, 2 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question