当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How can i get context parameter value in jsp.?

问题描述:

 <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

分享给朋友:
您可能感兴趣的文章:
随机阅读: