jsp:include标签,无法正常工作,请高手指点!高分回赠!

来源:百度知道 编辑:UC知道 时间:2024/06/07 19:37:55
运行jsp_include.jsp时只要去掉<jsp:include></jsp:include>的内容,正常显示.否则出错:错误页面如下:
----------------------------------------------------------------
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /test/WebContent/book/ch3/jsp_include.jsp(9,31) Attribute value request.getParameter("username") is quoted with " which must be escaped when used within the value
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)

-----------------------------------------------

因为<jsp:param>标签中不能直接使用request.getParameter等方法,会在jsp转换为java文件时造成编译错误,分开写就没事了
<%
String username = request.getParamter("username");
String password = request.getParameter("password");
%>
<jsp:include page="two.jsp" flush="true">
<jsp:param name="a1" value="<%=username%>" />
<jsp:param name="a2" value="<%=password%>" />
</jsp:include>

错误500,说明你要引入的文件有问题,去检查下吧!

你可以尝试下<jsp:include>其他的页面</jsp:include>

把static.html里面的
<html>
<body>

</body>
</html>
去掉

试试<%@include %>,看exception的意思是你的参数引用有问题!