<servlet> <servlet-name>SearchItemServlet</servlet-name> <servlet-class>com.bjpowernode.drp.basedata.web.SearchItemServlet</servlet-class> <!-- 初始化参数的设置 --> <init-param> <param-name>page-size</param-name> <param-value>3</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>SearchItemServlet</servlet-name> <url-pattern>/servlet/item/SearchItemServlet</url-pattern> </servlet-mapping>
//从配置文件的servlet配置中,取得servlet初始化参数page-size(页面大小) int pageSize=Integer.parseInt(this.getServletConfig().getInitParameter("page-size"));
<!-- 配置键值对,全局对象,所有的都能访问到 --> <context-param> <param-name>page-size</param-name> <param-value>3</param-value> </context-param>
//从application范围内取得page-size,application指的是ServletContext对象 int pageSize=Integer.parseInt(this.getServletContext().getInitParameter("page-seze"));
原文地址:http://blog.csdn.net/u010927139/article/details/46489201