Struts and Action

Posted on 2005-04-13
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
    LVL 35

    Expert Comment

    return actionMapping.findForward( "nameofmapping" ) ;
    LVL 15

    Accepted Solution

    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.

    Author Comment

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

    Expert Comment

    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.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    zeroMAx challenge 20 66
    FizzBuzz challenge 9 65
    scoresClump  challenge 31 87
    parentbit challenge 3 37
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now