问题描述:

 <context-param>

<param-name>productSearchRPP</param-name>

<param-value>8</param-value>

</context-param>

I want to get value of productSearchRPP in products.jsp page

网友答案:
pageContext.getServletContext().getInitParameter("key");

This is how you get context parameter value in JSP. In JSTL you can get it like this

${pageContext.servletContext}

Or

${applicationScope.attributeName}
网友答案:

Even you can try this in your jsp.

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

and with jstl you can use.

${initParam['theStringIWant']}
网友答案:
${initParam['productSearchRPP']}

Or, to get inside scriptlet

<%= pageContext.getServletContext().getInitParameter("productSearchRPP") %>
网友答案:

Try this:

application.getInitParameter("productSearchRPP")
网友答案:
 application.getServletContext().getInitParameter("productSearchRPP");

use this to get required result

相关阅读:
Top