struts2处理.do后缀的请求
来源:互联网 发布:js navigator.appname 编辑:程序博客网 时间:2024/05/16 06:12
默认情况下,struts2是无法处理以.do为后缀的请求url的(默认情况下是.action或者不填,可以参见org.apache.struts2包下的default.properties文件)。
但是struts2是一个高配置的框架,所以我们可以通过配置来处理以.do为后缀的请求。
struts2提供了一系列的常量来供我们来配置。
如:我们可以在struts.xml文件中配置
如果配置多个,可以以逗号分隔开
如:
使struts2能够处理以.do为后缀的url。
同时我们也可以通过资源文件的方式来配置。
可以在我们项目的类路径下创建一个struts.properties文件。
然后可以在此资源文件中加入
struts.action.extension=do
struts2还提供了其他的方式来加载常量,推荐在struts.xml文件中配置。
struts2加载常量的顺序是:
struts-default.xml
struts-plugin.xml
struts.xml
struts.properties
web.xml
我们可以通过启动tomcat时控制台打印的结果可以看到
信息: Parsing configuration file [struts-default.xml]
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Parsing configuration file [struts-plugin.xml]
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Parsing configuration file [struts.xml]
但是struts2是一个高配置的框架,所以我们可以通过配置来处理以.do为后缀的请求。
struts2提供了一系列的常量来供我们来配置。
如:我们可以在struts.xml文件中配置
- <constant name="struts.action.extension" value="do"/>
如果配置多个,可以以逗号分隔开
如:
- <constant name="struts.action.extension" value="do,action"/>
使struts2能够处理以.do为后缀的url。
同时我们也可以通过资源文件的方式来配置。
可以在我们项目的类路径下创建一个struts.properties文件。
然后可以在此资源文件中加入
引用
struts.action.extension=do
struts2还提供了其他的方式来加载常量,推荐在struts.xml文件中配置。
struts2加载常量的顺序是:
引用
struts-default.xml
struts-plugin.xml
struts.xml
struts.properties
web.xml
我们可以通过启动tomcat时控制台打印的结果可以看到
引用
信息: Parsing configuration file [struts-default.xml]
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Parsing configuration file [struts-plugin.xml]
2009-12-10 22:47:46 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Parsing configuration file [struts.xml]
在不同的配置文件里存在相同的常量的话,后者将会覆盖前者.
转自:http://skyuck.iteye.com/blog/545988
- struts2处理.do后缀的请求
- struts2处理.do后缀的请求
- struts2处理.do后缀的请求
- struts2处理.do后缀的请求
- struts2处理.do后缀的请求
- Struts2同时处理.do/.action后缀的请求
- struts2默认无法处理以.do后缀的请求
- Struts2 使用.do后缀的请求方式
- 默认情况下,struts2是无法处理以.do为后缀的请求url的
- 指定需要struts2处理的请求后缀
- 指定Struts2处理的请求后缀
- 指定需要struts2处理的请求后缀
- 指定Struts2处理的请求后缀
- 四、指定struts2处理请求的后缀
- struts2教程:7、指定Struts2处理的请求后缀
- Struts2 三、指定Struts2处理的请求后缀
- struts2-7指定struts2处理的请求后缀
- struts处理.do后缀请求报Struts2中关于"There is no Action mapped for namespace / and action name"的总结
- VB备忘录(16)图像处理
- 负载均衡集群解决方案 Nginx
- 函数调用约定 stdcall cdecl fastcall thiscall naked call
- 如何设置电脑共享打印机
- 巧用背景图实现精确套打
- struts2处理.do后缀的请求
- update virtualbox version from oracle website
- 查看角色中包含的权限
- 在Ubuntu下安装虚拟机
- 关于网络发送的数据缓冲例子(读数据和发送采用双线程)主要用于视频的实时传输
- 新建文本文档
- Qt中不规则窗体和部件的实现
- 当前路径和上级目录的表示方法
- java同步方法和同步代码块