Struts2的struts.properties文件在哪儿啊?
老师教我们Struts2的时候叫我们建了个Struts.xml文件啊?那struts.properties呢?不需要吗? 回答1:
struts.properties 是可以不要的!!!
因为 struts.xml文件中 有 <constant> 这个节点, 你可以把你想写在struts.properties的自定义配置写在 struts.xml文件当中. 例如,你想 开启 struts2 的开发模式
可以直接在 struts.xml文件当中写上.
<constant name="struts.devMode" value="true“>
不用再去 去创建 一个 struts.properties,并写上 struts.devMode = true 所有的配置项目,其实 你可以去看看 struts2 默认的配置文件 default.properties.
位置在 struts2-core-2.x.x.jar 的 org.apache.struts2 包 下面的 当然,你可能又会问了,如果同时都在两个文件配置了,一个相同的项目,哪个是有效的呢
他其实是有一个加载顺序的: 先加载 struts.xml,再加载 struts.properties
也就是说 struts.properties 是可以覆盖 struts.xml里面的 配置的,
具体 是否 要 struts.properties ,还是得根据 具体情况,具体分析吧,
不过 我基本上不用,免得 出现 配置混乱的情况.呵呵 PS: struts.xml 不能写成Struts.xml 哟 ,注意首字母 s不能写成大写了. 回答2:
需要,这个文件可以做一些相同的配置。
比如properties中:
#可以修改访问路径的后缀为do,action两个都可以
struts.action.extension=do,action
也可以在xml文件中同样设置:
<constant name="struts.action.extension" value="do,action“>
Struts2的struts.properties文件在哪儿啊?的更多相关文章
- Struts2中有关struts-default.xml,struts.xml,struts.properties文件详解
1) struts-default.xml 这个文件是struts2框架默认加载的配置文件.它定义struts2一些核心的bean和拦截器. <?xml version="1.0&qu ...
- struts2:struts.properties配置文件介绍及常量加载顺序
1. 背景 struts2框架中有两个核心配置文件,其中struts.xml文件主要负责管理应用中的action映射,以及该action包含的result定义等.除此之外,struts2框架还包括一个 ...
- struts.properties文件
此配置文件提供了一种机制来更改默认行为的框架.其实所有的struts.propertiesconfiguration文件中包含的属性也可以被配置在web.xml中使用的init-param,以及在st ...
- struts2——配置struts.xml文件
在struts2框架中struts.xml是应当放到src的根目录,程序编译后会将struts.xml放到WEB-INF/classes目录下. Struts2在web.xml中的一般配置如下: &l ...
- Struts2学习-struts.xml文件配置
学习框架过程中,一直对框架中的配置文件比较难理解,特搜集资料简要记录一下struts.xml文件遇到的问题. <?xml version="1.0" encoding=&qu ...
- struts2设置非默认路径的struts.properties以及.properties文件解决方案
一.web应用的classpath简介 classpath路径在每个J2ee项目中都会用到,即WEB-INF下面的classes目录,所有src目录下面的java.xml.properties等 ...
- Struts2配置之Struts.properties
Struts 2框架有两个核心配置文件,其中struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等.除此之 外,Struts 2框架还包含 s ...
- Struts2中.properties文件放置路径(classpath)
一.web应用的classpath简介 classpath路径,即WEB-INF下面的classes目录,所有src目录下面的java.xml.properties等文件编译后都会在此. Stru ...
- struts.properties配置详解
Struts 2框架有两个核心配置文件,其中struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等.除此之外,Struts 2框架还包含 st ...
随机推荐
- Inside of Jemalloc
INSIDE OF JEMALLOCThe Algorithm and Implementation of Jemalloc author: vector03mail: mmzsmm@163.co ...
- C#网络编程简单实现通信小例子-2
1.主界面 2.源代码 Client public partial class For ...
- 【CSS】盒模型+选择器(你选择的要操作的对象)
盒模型 转http://www.cnblogs.com/cchyao/archive/2010/07/12/1775846.html 1.w3c标准的盒模型和ie的盒模型主要差别在于content的w ...
- html 页面 ajax 方法显示遮罩
showLoading.css 样式: ;;list-style-type:none;} a,img{;} .overlay{;;;;;width:100%;height:100%;_padding: ...
- ASIHTTPRequest的使用(转)
转载自:http://fushengfei.iteye.com/blog/1147112 博客分类: IOS 原文地址:http://wiki.magiche.net/pages/viewpage ...
- bnu 4358 左手定则 (搜索)
http://www.bnuoj.com/bnuoj/problem_show.php?pid=4358 [题意]:给定起始位置和方向和目的地,按照左转.前进.右转.后退的优先级递减,也就是说能左转就 ...
- Why are very few schools involved in deep learning research? Why are they still hooked on to Bayesian methods?
Why are very few schools involved in deep learning research? Why are they still hooked on to Bayesia ...
- PAT-乙级-1030. 完美数列(25)
1030. 完美数列(25) 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CAO, Peng 给定一个正整数数列,和正整数p,设这 ...
- ASP + ACCESS保存图片文件之实现
con.execute "CREATE tblImg (lngId COUNTER PRIMARY KEY, binImg IMAGE)" set ads=createobject ...
- spoj 178
输出相邻的点 比较简单吧....... #include <cstdio> #include <cstring> using namespace std; int main ...