Struts2配置文件复用代码【web.xml、struts.xml、常量配置】
2017-04-27 12:09
525 查看
web.xml的分发器代码:
<!-- 引入struts核心过滤器 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
struts.xml代码:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="hello" extends="struts-default"> <action name="hello" class="action.HelloAction" method="execute"> <result name="success">/index.jsp</result> </action> </package> </struts>
常用的常量配置
<struts> <!-- 0. 请求数据编码 --> <constant name="struts.i18n.encoding" value="UTF-8"/> <!-- 1. 修改Struts默认的访问后缀 --> <constant name="struts.action.extension" value="action,do,"></constant> <!-- 2. 修改xml自动重新加载 --> <constant name="struts.configuration.xml.reload" value="true"/> <!-- 3. 开启动态方法调用 (默认不开启)--> <constant name="struts.enable.DynamicMethodInvocation" value="true"/> <!-- 4. 修改上传文件的最大大小为30M --> <constant name="struts.multipart.maxSize" value="31457280"/> </struts>
相关文章推荐
- Struts2配置文件复用代码【web.xml、struts.xml、常量配置】
- struts2文件上传下载前段html,struts.xml配置和后端代码
- 2.struts2配置文件Web.XML与Struts.XML模板详细说明
- struts2 的web.xml 配置文件报错org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
- struts1,struts2在web.xml里的配置文件
- struts2 配置文件 struts.xml
- [转]Struts配置文件详解,web.xml以及struts-cofig.xml,以及struts-cofig.xml中各个标签的作用。
- Java:Struts 项目中web.xml文件配置
- Struts2中的配置文件--web.xml文件
- Struts2.0配置文件(web.xml)
- struts2默认配置文件 struts-default.xml 研究
- 使用Struts1.x 与 struts2.x下的web.xml的配置
- Struts2中如何加载多个struts.xml配置文件
- Struts 项目中web.xml文件配置
- Struts2使用3-- Struts2的配置1-- web.xml 、struts.xml 配置
- Struts2的配置文件——struts.xml
- 为Struts应用配置Web.xml文件
- 配置安装Struts2 web.xml文件
- [Struts2]配置 web.xml文件
- struts2.2.3 web.xml文件配置