I am using Struts 2 convention plugin. I don't want to use any XML based configurations in my application. So, in this case, how how to remove .action
extension from URL without using <constant name="struts.action.extension" value="" />
in struts.xml
? I am currently using struts.xml
file only to remove .action
extension. Is there any annotation to remove .action
extension?
Asked
Active
Viewed 1,632 times
1

Roman C
- 49,761
- 33
- 66
- 176

user995656
- 123
- 1
- 14
-
The default already allows for an empty action suffix; see [default struts.properties file](http://struts.apache.org/development/2.x/docs/strutsproperties.html), specifically, `struts.action.extension=action,,` Is it really onerous to *allow* `.action` along with an empty extension? – Dave Newton Aug 25 '14 at 13:09
1 Answers
3
There isn't such annotation. You can use struts.properties
or define a constant in web.xml
like
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.action.extension</param-name>
<param-value>,</param-value>
</init-param>
</filter>

Roman C
- 49,761
- 33
- 66
- 176