如何在jsp中获取上下文参数值?

 productSearchRPP 8  

我想在products.jsp页面中获得productSearchRPP的价值

即使你可以在你的jsp中试试这个。

 ServletContext context = pageContext.getServletContext(); com = context.getInitParameter("com"); 

并使用jstl你可以使用。

 ${initParam['theStringIWant']} 
 pageContext.getServletContext().getInitParameter("key"); 

这是您在JSP中获取上下文参数值的方法。 在JSTL中你可以这样得到它

 ${pageContext.servletContext} 

要么

 ${applicationScope.attributeName} 
 ${initParam['productSearchRPP']} 

或者,进入scriptlet

 <%= pageContext.getServletContext().getInitParameter("productSearchRPP") %> 

尝试这个:

 application.getInitParameter("productSearchRPP") 
  application.getServletContext().getInitParameter("productSearchRPP"); 

用它来获得所需的结果