从web.xml中获取小弟我们需要的参数

从web.xml中获取我们需要的参数

从web.xml中获取我们需要的参数【转载】

1、在web.xml中设置如下:
<context-param>
        <param-name>pageSize</param-name>
        <param-value>4</param-value>
</context-param>
2、在jsp页面中将web.xml中的参数pageSize的值读出
int pageSize = Integer.parseInt(this.getServletContext().getInitParameter("pageSize"));