struts2处理.do后缀de请求
2016-05-17 12:59
399 查看
默认情况下,struts2是无法处理以.do为后缀的url请求(默认情况下是.action或者不填,可以参见org.apache.struts2包下的default.properties文件)
但是strurts是一个高配置的框架,所以我们可以通过配置来处理以do为后缀的请求。
struts2提供了一系列的常量来供我们配置。
如:我们可以在Struts.xml文件来配置
constant name="struts.action.extension" value="do"
如果配置多个,可以以逗号分隔开
如:
Java代码
是其能够处理以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]
但是strurts是一个高配置的框架,所以我们可以通过配置来处理以do为后缀的请求。
struts2提供了一系列的常量来供我们配置。
如:我们可以在Struts.xml文件来配置
constant name="struts.action.extension" value="do"
如果配置多个,可以以逗号分隔开
如:
Java代码
是其能够处理以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]
相关文章推荐
- javaweb学习总结(十六)——JSP指令
- Java总结篇系列:Java多线程
- Java中 char和int之间的转换
- java编码规范及优化总结
- JAVA设计模式(01):创建型-工厂模式【简单工厂模式】(Simple Factory)
- Spring MVC入门
- java 中 null 与""的区别
- sun.misc.BASE64Encoder找不到jar包的解决方法(eclipse中红叉)
- 5.17 JAVA
- java之斐波拉契问题(生兔子)
- 用java比较两个集合对象中不一样的元素。
- Java中 子线程JOptionPane.showMessageDialog()创建对话框不能正常显示,显示空白,也不能接受消息的问题
- ACM21 三个水杯-Java
- java中Map,List与Set的区别
- Spring中@Controller和@RestController之间的区别
- java+lucene中文分词,百度搜索原理解析,十分重要的东西
- Java抽象类的一个例子
- eclipse中查看JDK安装路径和替换JDK版本
- 二叉排序树-java语言描述
- Javac编译过程