struts2_5_struts中常量的配置

常量有两种配置方式:

1)在struts.xml中配置:(建议使用此种配置方式)

<struts>
  <constant name=”struts.action.extension” value=”action”/>
<struts>

2)在struts.properties中配置常量:

  truts.action.extension = action

因为常量可以在下面多配置文件中进行定义,所以我们需要了解struts2加载常量的搜索顺序:

struts-default.xml

struts-plugin.xml

struts.xml

struts.properties

web.xml

如果在多个文件中配置了同一个常量,则后一个文件中配置的常量值会覆盖前面文件中配置的常量值。

常用的常量介绍:

1)指定编码集:

<constant name=”struts.i18n.encoding” value=”UTF-8”>

2)指定struts2请求处理的后缀:

该属性的默认值是Action,即所有匹配“*.action”的请求都由Struts2处理,如果需要指定多个后缀,则多个后缀之间用逗号”,“分隔开

<span style="font-size:12px;"><constant name=”struts.action.extension” value=”do,action”/></span>

3)xml文件自动重新加载:

该文件当struts被文件修改后,系统会自动重新加载该文件,默认值为false,开发阶段最好设置为true,

<span style="font-size:12px;"><constant name=”struts.configuration.xml.reload” value=”true”/></span>

4)打印错误信息的常量:

次常量在开发模式下使用,会打印出更详细的错误信息

<constant name=”strus.devMode” value=”true”/>

5)struts支持动态属性:

该属性设置struts是否支持动态属性,该属性的默认值是true,关闭该属性时可以设置为false,

<constant name=”struts.enable.DynamicMethodInvocation” value=”false”/>

6)管理上传文件大小的常量:

该属性可以设置上传文件的大小

<constant name="struts.multipart.maxSize" value="1000000"/>

struts2_5_struts中常量的配置

时间: 2024-08-06 20:05:23

struts2_5_struts中常量的配置的相关文章

.Net中Web.config 配置详解

花了点时间整理了一下ASP.NET Web.config配置文件的基本使用方法.很适合新手参看,由于Web.config在使用很灵活,可以自定义一些节点.所以这里只介绍一些比较常用的节点. <?xml version="1.0"?> <!--注意: 除了手动编辑此文件以外,您还可以使用 Web 管理工具来配置应用程序的设置.可以使用 Visual Studio 中的“网站”->“Asp.Net 配置”选项. 设置和注释的完整列表在 machine.config.

struts2中常量的修改

<?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>在struts2的struts.

修改 /var/lib/locales/supported.d/local 文件(使用 locale -a 命令查看系统中所有已配置的 locale)

转自:http://zyxhome.org/wp/cc-prog-lang/c-stdlib-setlocale-usage-note/ http://www.west263.com/info/html/caozuoxitong/FreeBSD/20090513/126191.html C 和 C++ 的标准库分别有自己的 locale 操作方法,C 标准库的 locale 设定函数是 setlocale(),而 C++ 标准库有 locale 类和流对象的 imbue() 方法.这篇是我自己的

在Web.config或App.config中的添加自定义配置

.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置,所以忍不住写一篇用系统自定义配置的随笔了. 如果你已经对自定义配置了如指掌,请忽略这篇文章.? 言归正传,我们先来看一个最简单的自定义配置 <?xml version="1.0" encoding="utf-8" ?> <configuration>

MyBatis框架中Mapper映射配置的使用及原理解析(七) MapperProxy,MapperProxyFactory

从上文<MyBatis框架中Mapper映射配置的使用及原理解析(六) MapperRegistry> 中我们知道DefaultSqlSession的getMapper方法,最后是通过MapperRegistry对象获得Mapper实例: public <T> T getMapper(Class<T> type, SqlSession sqlSession) { final MapperProxyFactory<T> mapperProxyFactory =

Django中的URL配置和模板

Django中的URL配置 : 实例: Python代码   urlpatterns = patterns('', # Example: # (r'^myweb/', include('myweb.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: # (r'^admin/doc

MyBatis框架中Mapper映射配置的使用及原理解析(三) 配置篇 Configuration

从上文<MyBatis框架中Mapper映射配置的使用及原理解析(二) 配置篇 SqlSessionFactoryBuilder,XMLConfigBuilder> 我们知道XMLConfigBuilder调用parse()方法解析Mybatis配置文件,生成Configuration对象. Configuration类主要是用来存储对Mybatis的配置文件及mapper文件解析后的数据,Configuration对象会贯穿整个Mybatis的执行流程,为Mybatis的执行过程提供必要的配

MyBatis框架中Mapper映射配置的使用及原理解析(二) 配置篇 SqlSessionFactoryBuilder,XMLConfigBuilder

在 <MyBatis框架中Mapper映射配置的使用及原理解析(一) 配置与使用> 的demo中看到了SessionFactory的创建过程: SqlSessionFactory sessionFactory = null; String resource = "mybatisConfig.xml"; try { sessionFactory = new SqlSessionFactoryBuilder().build(Resources .getResourceAsRea

Xcode 中 Git 的配置与使用

Xcode 中 Git 的配置与使用主要围绕下面几个问题展开阐述: 问题1,如何在Xcode中创建本地代码库,并添加和提交代码到本地代码库? 问题2,如何在Xcode中提交推送给远程服务器代码库? 问题3,如何在Xcode中克隆远程服务器代码库到本地? 问题4,如何使用Xcode获取远程代码库数据,并解决冲突问题? 一.如何在Xcode中创建本地代码库,并添加和提交代码到本地代码库? 创建代码库有两种方式: 方式1:新建工程的时候创建 1. 勾选Create Git repository on