Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Before starting, I'm sorry for my bad English, because English is not my first language. However, I have a problem with Struts 2 redirecting.

One part of my Struts.xml file is like this:
XML
<package name="login" namespace="/" extends="struts-default">
    <action name="login" class="Action.loginAction">
        <result name="success" type="redirectAction">
            <param name="actionName">search</param>
            <param name="namespace">/</param>
        </result>
        <result name="error">/login.jsp</result>
        <result name="input">/login.jsp</result>
    </action>
</package>

I have a loginAction that's responsible for logging in the user (no matter what is the content of this file). When the result of this action is success, I want to redirect to search action. Everything works fine, but my problem is, when I redirect to search action, the URL looks like this: http://localhost:8080/MyWebApplication/search.action

I want to have the .action removed from the URL, when redirecting to a particular action. What do I need to change to fix this?

Thanks for your attention.
Posted
Updated 28-Dec-13 14:22pm
v2

1 solution

Try this....
XML
<struts>
 
  <constant name="struts.action.extension" value="" /> 
  
</struts>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900