开发者

Is it possible to have a Struts2 application without using any suffixes like action or do?

开发者 https://www.devze.com 2023-01-14 19:40 出处:网络
By default, Struts 2 uses the suffix .action to represent action URLs. So, even if I want to get t开发者_C百科o a login page, I need to use a URL something like : http://mysite.com/login.action.

By default, Struts 2 uses the suffix .action to represent action URLs. So, even if I want to get t开发者_C百科o a login page, I need to use a URL something like : http://mysite.com/login.action.

But I feel the above URL is not flexible and not SEO friendly. So, is there any way to avoid the .action suffix or any suffixes completely and just use plain URLs (eg: http://mysite.com/login)?


Yes, I have tested that add the below codes in your struts.xml file, If you want to remove any suffix from URL, you can do this:

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


Yes, it is possible, you can use something like this <constant name="struts.action.extension" value="htm"> in struts.xml file

0

精彩评论

暂无评论...
验证码 换一张
取 消