struts2—constant常量的配置常用方法

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

<!-- 把它设置为开发模式,发布时要设置为false -->
    <constant name="struts.devMode" value="true" />
    <!-- 设置在class被修改时是否热加载,发布时要设置为false -->
    <constant name="struts.convention.classes.reload" value="true"/>
    <!-- 自动动态方法的调用,使用这个设置后可以这样调用:action!method -->
    <constant name="struts.enable.DynamicMethodInvocation" value="true" />
    <!-- 指定jsp文件所在的目录地址 -->
    <constant name="struts.convention.result.path" value="/WEB-INF/content/" />
    <!-- 使用struts-default默认的转换器,如果是rest的使用:rest-default,rest需要rest的jar插件 -->
    <constant name="struts.convention.default.parent.package" value="struts-default"/>
    <!-- 用于配置包名后缀。默认为action、actions、struts-->
    <constant name="struts.convention.package.locators" value="actions" />
    <!-- 用于配置类名后缀,默认为Action,设置后,Struts2只会去找这种后缀名的类做映射 -->
    <constant name="struts.convention.action.suffix" value="Action"/>
    <!-- 设置即使没有@Action注释,依然创建Action映射。默认值是false。因为Convention-Plugin是约定优于配置的风格,
        可以不通过注解根据预先的定义就能访问相应Action中的方法 -->
    <constant name="struts.convention.action.mapAllMatches" value="true"/>
    <!-- 自定义jsp文件命名的分隔符 -->
    <constant name="struts.convention.action.name.separator" value="-" />
    <!-- 国际化资源文件名称 -->
    <constant name="struts.custom.i18n.resources" value="i18n" />
    <!-- 是否自动加载国际化资源文件  -->
    <constant name="struts.i18n.reload" value="true" />
    <!-- 浏览器是否缓存静态内容 -->
    <constant name="struts.serve.static.browserCache" value="false" />
     <!-- 上传文件大小限制设置 -->
    <constant name="struts.multipart.maxSize" value="-1" />
    <!-- 主题,将值设置为simple,即不使用UI模板。这将不会生成额外的html标签 -->
    <constant name="struts.ui.theme" value="simple" />
    <!-- 编码格式 -->
    <constant name="struts.i18n.encoding" value="UTF-8" />

</struts>

时间: 2024-08-10 21:19:10

struts2—constant常量的配置常用方法的相关文章

struts2中的constant常量配置

struts2中的constant配置详解 本文主要讲解一下struts2中的constant常量配置,内容主要来自于互联网的整理.<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.ap

【Struts2】☆★之详解constant常量配置问题

[Struts2]☆★之详解constant常量配置问题 本文详细讲解web开发中使用Struts2时constant的常量配置问题 如下,constant添加位置 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" &qu

Struts2笔记——1.常规配置

Struts2应用的开发步骤 导入必要的包 通过MyEclipse对项目导入Struts2包,一般只需要导入core这个包就可以.如果要想手动导入,则需要将commons-logging, freemarker, ognl, struts2-core, xwork-core, commons-fileupload, jacassist, commons-long3这几个包复制到web-inf下的lib文件夹下.或者直接使用MyEclipse自带的增加Struts2的capacities的方法,选

struts2_5_struts中常量的配置

常量有两种配置方式: 1)在struts.xml中配置:(建议使用此种配置方式) <struts> <constant name="struts.action.extension" value="action"/> <struts> 2)在struts.properties中配置常量: truts.action.extension = action 因为常量可以在下面多配置文件中进行定义,所以我们需要了解struts2加载常量的搜

Struts2学习笔记二 配置详解

Struts2执行流程 1.简单执行流程,如下所示: 在浏览器输入请求地址,首先会被过滤器处理,然后查找主配置文件,然后根据地址栏中输入的/hello去每个package中查找为/hello的namespace,然后在包下寻找名为HelloAction的action,反射创建控制器HelloAction对象,调用method指定的方法hello,拿到返回值“success”,去result的配置节找success对应的页面(hello.js),呈现给用户. 2.Struts的架构,具体参考这里

解决struts2中validation.xml配置无效的问题

解决struts2中validation.xml配置无效的问题,我使用了xml的验证,却始终发现无法生效,后面发现才是xml的头文件的格式问题,修改了一下就好了. 成功的xml <!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> <val

关于Struts2的Validator的配置找不到DTD

看教材的时候写的DTD是 <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.3//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd"> 用浏览器访问URL直接404,在eclipse中也没有代码提示,说明这个DTD已经不可用 然后去看Struts2的官方JAVADOC,找到http:

转载 - Struts2 拦截器详细配置过程

出处:http://www.blogjava.net/zzzlyr/archive/2009/10/12/297998.html Struts2 拦截器详细配置过程 1:所有拦截器的超级接口Interceptor ,Action去实现这个接口; Interceptor 它其中有三个方法(init(),destroy() ,interceptor()): Init()方法:在服务器起动的时候加载一次,并且只加载一次; Destroy()方法:当拦截器销毁时执行的方法; Interceptor()方

基于IDEA 最新Spirng3.2+hibernate4+struts2.3 全注解配置 登录

原文 基于IDEA 最新Spirng3.2+hibernate4+struts2.3 全注解配置 登录 首先说说 IDEA 12,由于myeclipse越来越卡,我改用idea12 了,发现其功能强悍到eclipse无法比拟,此款ide理解上下文是一等一的,不用什么jquery插件,extjs插件,都可以实现全智能的代码提示.速度什么的都比myeclipse快.而且IDEA提供了android支持struts spring hibernate 支持.下面,我讲教大家完成一个基于全注解的Spirn