<%@ page language="java" contentType="text/html;charset=gbk"%>
<html>
<head>
<title>jap:include</title>
</head>
<body>
<form action="" method="post" name="form">
<jsp:include page="jspinclude.jsp" flush="true">
<jsp:param name="t" value="<%=request.getParameter("test")%>"/>
</jsp:include>
<br>
<input type="text" name="test">
<input type="submit" name="submit" value="测试">
</form>
</body>
</html>jspinclude.jsp的代码
<%@ page language="java" contentType="text/html; charset=gbk" language="java"
pageEncoding="gbk"">
<html>
<head>
<title>jsp:include</title>
</head>
<body>
读取页面信息<%=request.getParameter("t") %>
</body>
</html>
产生的异常
org.apache.jasper.JasperException: /lesson01/test7.jsp(9,30) Attribute value request.getParameter("test") 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)
请教各位问题出现在哪里?非常感谢各位了
<html>
<head>
<title>jap:include</title>
</head>
<body>
<form action="" method="post" name="form">
<jsp:include page="jspinclude.jsp" flush="true">
<jsp:param name="t" value="<%=request.getParameter("test")%>"/>
</jsp:include>
<br>
<input type="text" name="test">
<input type="submit" name="submit" value="测试">
</form>
</body>
</html>jspinclude.jsp的代码
<%@ page language="java" contentType="text/html; charset=gbk" language="java"
pageEncoding="gbk"">
<html>
<head>
<title>jsp:include</title>
</head>
<body>
读取页面信息<%=request.getParameter("t") %>
</body>
</html>
产生的异常
org.apache.jasper.JasperException: /lesson01/test7.jsp(9,30) Attribute value request.getParameter("test") 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:include page="jspinclude.jsp" flush="true">
<jsp:param name="t" value=" <%=request.getParameter("test")%>"/>
</jsp:include>
<br>
<input type="text" name="test">
<input type="submit" name="submit" value="测试">
</form>
</body>
</html>
<%=request.getParameter("test")%>怎么会有值啊!
那你的包含页面不是也获取<%=request.getParameter("t") %> ,关系太乱了
<jsp:param name="t" value=" <%=request.getParameter('test')%>"/>
</jsp:include>
<jsp:param name="t" value=" <%=request.getParameter("test")%>"/>
</jsp:include>
表示给属性传值
你有这个(t)属性吗
支持quxiuer 的代码
<jsp:param name="t" value=" <%=request.getParameter("test")%>"/>
</jsp:include> 如果在地址栏中后面添加 ?test=xxx
有时候就没有问题了 我想最终的问题运行第一个页面的时候,不能使request.getParameter("test")获得值
<html>
<head>
<title>jap:include </title>
</head>
<body>
<form action="" method="post" name="form">
<jsp:include page="jspinclude.jsp" flush="true">
<jsp:param name="t" value=" <%=request.getParameter(\"test\")%>"/>
</jsp:include>
<br>
<input type="text" name="test">
<input type="submit" name="submit" value="测试">
</form>
</body>
</html>
楼主 按照上面的方法做就可以了 虽然在编辑器中会显示有错 但是运行起来却没有问题,有可能是tomcat的版本不同导致的。jsp在编译jsp页面时,将<%=request.getParameter("searchtype")%>作为变量进行处理。因此,遇到里面的"会报错。楼主没事可以看看我的个人网站www.uuxiao.com中有相关讲解