context-param使用

web.xml设置参数
<context-param>
<param-name>ENCODE</param-name>
<param-value>utf-8</param-value>
</context-param>


程序获得参数
HttpServletRequest hsr=(HttpServletRequest)request;
String encode=hsr.getSession().getServletContext().getInitParameter("ENCODE");

你可能感兴趣的:(Web,xml)