尝试包含具有动态 URL 的 jsp 页面时出现 Jasper 异常

Jasper exception occurring while trying to include a jsp page with dynamic URL

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

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"):
%>

省略 stdInfoViewURL 中的 contextRoot 并直接

String stdInfoViewURL = "/jsp/student/ViewStudentDetails.jsp":