这是我的 jsp 文件的一部分。我正在努力将参数值设置为 SalesClientDetails.jsp。我没有使用这种样式 <% %>。如何传递参数我尝试使用 jsp:expression 但没有成功。
<jsp:scriptlet>
if (request.getParameter("clientid") != null) {
String clientid = request.getParameter("clientid");
</jsp:scriptlet>
<jsp:include page="SalesClientDetails.jsp">
<jsp:param name="clientid" value= />
</jsp:include>
<jsp:scriptlet>
}
</jsp:scriptlet>
最佳答案
简单,不使用 scriptlet,也不符合 JSP 标签的风格。使用 JSTL/EL .
<c:if test="${not empty param.clientid}">
<jsp:include page="SalesClientDetails.jsp" />
</c:if>
在 SalesClientDetails.jsp
中获取它
${param.clientid}
关于java - 如何将参数传递给jsp :include,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5850954/