struts2不显示.do .action 后缀
2016-03-27 17:32
411 查看
struts2是可以配置默认的后缀名的,如http://localhost:8080/test.action,这个是默认的,但是也可以通过配置去修改这个.action为别的。
这里是通过一个常量配置改变的。
<constant name="struts.action.extension" value="do"/>
但是我很不喜欢有后缀,百度了很多大家的结论一般都是使用SmartUrls和urlrewritefilter这两个解决,但是我只是想把后缀去掉而已,就让我增加别的组件这个实在很不爽,最后终于找到了个方法:
<constant name="struts.action.extension" value=","/>
在这里把value配置为,就可以使用http://localhost:8080/test完成访问了
在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,,
这个不建议酱紫做。
因为上传下载可能会被拦截
这里是通过一个常量配置改变的。
<constant name="struts.action.extension" value="do"/>
但是我很不喜欢有后缀,百度了很多大家的结论一般都是使用SmartUrls和urlrewritefilter这两个解决,但是我只是想把后缀去掉而已,就让我增加别的组件这个实在很不爽,最后终于找到了个方法:
<constant name="struts.action.extension" value=","/>
在这里把value配置为,就可以使用http://localhost:8080/test完成访问了
在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,,
这个不建议酱紫做。
因为上传下载可能会被拦截
相关文章推荐
- spring3 struts2 利用aop在actioin层捕获异常
- java switch语句练习 从键盘输入2个数和一个运算符(+,-,*,/),输出运算结果
- struts2 findValue 等引用错误
- 20145120 《Java程序设计》第4周学习总结
- Java 循环语句之多重循环
- java队列、栈和多线程结合使用的例子
- Spring源码导入MyEclipse
- An internal error occurred during: "Add Deployment". Container with path org.eclipse.jdt.launching.
- Java中String为什么是不可变的
- xml编程:利用java程序去增删改查(CRUD)xml中的数据
- IT十八掌作业_java基础第十二天_集合
- 20145223《Java程序程序设计》第4周学习总结
- 白话Spring(中级篇)---注解(3)
- Java循环语句之 for
- SSM(maven) eclipse 搭建教程(合集)
- 20145314郑凯杰 《Java程序设计》第4周学习总结
- 插入排序(JAVA语言描述)
- <O'Reilly Java Swing> - Note01
- Java条件语句之 switch
- Java_chapter07_多维数组