![](/img/trans.png)
[英]I can't get a json object from servlet to jsp. How can I do?
[英]How can i get context parameter value in jsp.?
<context-param>
<param-name>productSearchRPP</param-name>
<param-value>8</param-value>
</context-param>
我想在products.jsp页面中获得productSearchRPP的价值
pageContext.getServletContext().getInitParameter("key");
这是您在JSP中获取上下文参数值的方法。 在JSTL中你可以这样得到它
${pageContext.servletContext}
要么
${applicationScope.attributeName}
${initParam['productSearchRPP']}
或者,进入scriptlet
<%= pageContext.getServletContext().getInitParameter("productSearchRPP") %>
即使你可以在你的jsp中试试这个。
ServletContext context = pageContext.getServletContext();
com = context.getInitParameter("com");
并使用jstl你可以使用。
${initParam['theStringIWant']}
尝试这个:
application.getInitParameter("productSearchRPP")
application.getServletContext().getInitParameter("productSearchRPP");
用它来获得所需的结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.