简体   繁体   中英

redirect action result in struts2 not working

<action name="doLogin" class="controller.LoginAction">
    <result name="input">login.jsp</result>
    <result name="error">login.jsp</result>
    <result name="success" type="redirectAction">
        <param name="actionName">doStartIndex</param>
    </result>
    <result name="adminpage" type="redirect">adminPage.jsp</result>
</action>

<action name="doStartIndex" class="controller.IndexingAction" method="autoAllocate">
    <result>home.jsp</result>
</action>

NOTE: I'm using struts2.2.1

by using this i'm trying to move from one action to another but I get the following 404:

localhost:80801/ai/
The requested resource (/ai/) is not available.

In one of my scenario I was in need of creation a bean class but since the action class has the same bean elements that which I want to create in my new bean class except the parameterized constructor.

So I was testing to use the action class inserted to creating a new bean class. First I was wrong that an action class can also have parameterized constructor and while I tried to work with that my action, it fails to work and returns to the same page where I initiated that action and even I did not get any stack trace too.

So People keep remember that we should not try to create parameterized constructor for an action class with out creating a default constructor. I hope about this last line I'm correct if I need any correction please correct me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM