怎样获得(读取)web.xml配置文件的参数
来源:互联网 发布:球球大作战 知乎 编辑:程序博客网 时间:2024/06/05 04:07
参考代码如下:
com.atguigu.struts2.app.converters.DateConverter.java
public DateFormat getDateFormat(){
if(dateFormat ==null){
//获取当前 WEB应用的初始化参数 pattern(该参数在WEB-INF下的web.xml文件中)
//第一次用的时候获取,并加载相关的信息
//这种方法是使用/struts2-6/src/xwork-conversion.properties配置文件
//xwork-conversion.properties配置文件的内容:
//java.util.Date=com.atguigu.struts2.app.converters.DateConverter
ServletContext servletContext = ServletActionContext.getServletContext();
System.out.println(servletContext);
String pattern = servletContext.getInitParameter("pattern");
dateFormat = new SimpleDateFormat(pattern);
}
returndateFormat;
}
0 0
- 怎样获得(读取)web.xml配置文件的参数
- 怎样从web.xml配置文件中获得元素的值
- 怎样读取和处理XML的配置文件
- J2EE基础:怎样读取和处理XML的配置文件
- 读取web.xml参数
- 读取web.xml参数
- 读取web.xml的配置参数
- XML 配置文件的读取
- web工程读取自定义xml配置文件的方法
- servlet 通过读取web.xml获得全局变量
- 读取WEB-INF 下applicationContext.xml配置文件
- 读取Web.xml中各种参数的方法
- jsp中读取web.xml中配置的参数
- 读取web.xml中自定义的参数与值
- XML配置文件的读取处理
- XML配置文件的读取(sax)
- XML配置文件的读取处理
- XML配置文件的读取处理
- hdu 4869 Turn the pokers (思维)
- SOCKET 函数介绍
- 判断电话号码是否合法
- 程序员面试谈薪资的6大技巧
- 判断对称数
- 怎样获得(读取)web.xml配置文件的参数
- 判断整数是否有相同部分
- ELFHash 算法
- Stanford ML - Regularization 正则化
- Cocos2d-x的内存管理机制概述
- 换个角度理解正则表达式
- tomcat和apache集群
- 手机号码合法性判断2对
- POJ3977 Subset 折半枚举