web.xml中env-entry元素的处理方
web.xml 初始值
env-entry>
<env-entry-name>sql_type</env-entry-name>
<env-entry-value>oracle</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>comtime</env-entry-name>
<env-entry-value>60000000</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>istest</env-entry-name>
<env-entry-value>0</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
------------------获取该设置值的办法----------------------
该函数用于得到web.xml中的参数.
public static String getContextParameter(String Param)
{
String ParamValue = null;
try
{
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
ParamValue = (String)envCtx.lookup(Param);
}
catch(Exception e)
{
Func.LogInfo("获得配置参数!");
}
return ParamValue;
}