web.xml中配置的struts2核心控制器会将请求按照配置url进行过滤,然后将过滤后的以.action结尾的请求交给struts处理,具体交给那一个action,由请求的.action前面的name和struts.xml配置的name匹配决定。也就是说struts2默认处理的是.action的请求,那如果要处理以其他名字为后缀的请求呢?比如.do,这时需要修改struts.xml,
增加如下的配置即可:
<constant name="struts.action.extension" value="do,action"/>
上面的配置表明会处理以.do和.action结尾的请求。