1

When user makes login then on success browser redirect to

http://appname.com/main.action How can I make so that adress line will looks like http://appname.com/main

<action name="login"
    class="user.action.LoginAction" method="execute">
    <result name="success" type="redirectAction">
        main
    </result>
    <result name="error">/login.jsp</result>
</action>
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • possible duplicate of [Going from a local testing environment to live site](http://stackoverflow.com/questions/17391423/going-from-a-local-testing-environment-to-live-site) – Roman C May 29 '15 at 16:06

1 Answers1

2

You must set the following property in the struts.xml :

<constant name="struts.action.extension" value=","/>

You can set different extensions, or no extension at all, that is specified with the comma for a reason, as you can read in this answer.

It's generally used together with Advanced Wildcard Mappings,to create user-friendly pretty URLs.

Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • Hi Andrea, i want hide the .action extension using struts 1 . Can u help me how to do ? – Thadeuse Oct 25 '19 at 03:43
  • https://stackoverflow.com/questions/25032331/how-to-remove-do-prefix-from-url-in-struts1 – Andrea Ligios Oct 25 '19 at 07:43
  • Hi Andrea , I have put like that only even though its not working still .do extension is appear in the URL – Thadeuse Oct 25 '19 at 08:36
  • How can the `.do` extension keep appearing if [you wrote that your current extension is `.action`](https://stackoverflow.com/q/58553020/1654265)?? Please, read _every_ sentence from _every_ answer (_including_ the comments) from that Q&A, don't just copy-paste. That said, my religion imposes me not to discuss Struts1 anymore, sorry :] – Andrea Ligios Oct 25 '19 at 09:15