尝试包含带动态URL的jsp页面时发生Jasper异常

时间:2017-12-08 06:09:19

标签: java jsp jspinclude

请查看以下代码段,让我知道这有什么问题,因为我在尝试运行时遇到以下错误。

org.apache.jasper.JasperException: The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements

org.apache.jasper.JasperException: Expecting "jsp:param" standard action with "name" and "value" attributes

这是我尝试执行的代码

<%
    String contextRoot = request.getContextPath();
    String stdInfoViewURL = contextRoot.concat("jsp/student/ViewStudentDetails.jsp"):
%>

<html><body>

<jsp:include page="<%=stdInfoViewURL%>" flush="true">

    <jsp:param name="studentId" value="ABC123" />
    <jsp:param name="studentName" value="MARK TAYLOR" />

</jsp:include>

</body></html>

我甚至尝试过以下方式声明java对象。但没有运气。

<%!
    String contextRoot = request.getContextPath();
    String stdInfoViewURL = contextRoot.concat("jsp/student/ViewStudentDetails.jsp"):
%>

1 个答案:

答案 0 :(得分:2)

忽略QGraphicsView中的contextRoot,然后点击

stdInfoViewURL