struts2 does not show .do .action suffix

Struts2 can configure the default suffix name, such as http://localhost:8080/test.action, this is the default, but you can also modify this .action to something else through configuration.

This is changed through a constant configuration.

  1. <constant name="struts.action.extension" value="do"/>  
But I don't like suffixes very much. Many people on Baidu have come to the conclusion that they are generally solved by using SmartUrls and urlrewritefilter, but I just want to remove the suffix, so it's really unpleasant for me to add other components. Finally, I finally Found a way:
<constant name="struts.action.extension" value=","/> 
Configure the value here, you can use http://localhost:8080/test to complete the access


在struts2的默认常量配置文件中(default.properties,在struts-core-2.3.x.jar的org.apache.struts2下),有这么一段内容
### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
### The blank extension allows you to match directory listings as well as pure action names
### without interfering with static resources, which can be specified as an empty string
### prior to a comma e.g. struts.action.extension=, or struts.action.extension=x,y,z,,
struts.action.extension=action,,

This is not recommended for sauce purple.
Because upload and download may be blocked

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324779157&siteId=291194637