错了,是出这样的异常:
Error: 500
Location: /test/jsp_include.jsp
Internal Servlet Error:org.apache.jasper.compiler.ParseException: C:\jakarta-tomcat-3.3.2\webapps\test\jsp_include.jsp(8,57) Attribute name has no value
at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:485)
......我把
<jsp:include page="two.jsp" flush="true" >
<jsp:param name="a1" value="<%=request.getParameter("name")%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")%>"/>
</jsp:include>改成<jsp:include page="two.jsp" flush="true" />
就没事,好象这2句有什么问题?
<jsp:param name="a1" value="<%=request.getParameter("name")%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")%>"/>
Error: 500
Location: /test/jsp_include.jsp
Internal Servlet Error:org.apache.jasper.compiler.ParseException: C:\jakarta-tomcat-3.3.2\webapps\test\jsp_include.jsp(8,57) Attribute name has no value
at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:485)
......我把
<jsp:include page="two.jsp" flush="true" >
<jsp:param name="a1" value="<%=request.getParameter("name")%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")%>"/>
</jsp:include>改成<jsp:include page="two.jsp" flush="true" />
就没事,好象这2句有什么问题?
<jsp:param name="a1" value="<%=request.getParameter("name")%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")%>"/>
<body>
<form method=post action="jsp_include.jsp">
<table>
<tr>
<td>please input your name:</td></tr>
<tr><td>
<input type=text name=name>
</td></tr>
<tr><td>input you password:</td>
<td>
<input type=text name=password>
</td>
</tr>
<tr>
<td>
<input type=submit value=login>
</td>
</tr>
</table>
</body>
</html>
举例说明include的工作原理:<br>
this is a1=<%request.getParameter("a1")%><br>
this is a2=<%request.getParameter("a2")%><br>
<%out.println("hello from two.jsp");%>
this is a2=<%=request.getParameter("a2")%><br>
去掉,一个jsp文件中只允许出现一次
this is a2=<%request.getParameter("a2")%><br>
这是错了,不过我改了之后还是这样的问题。
我现在要走了,你其实应该告诉我们异常的!
我刚做过测试,是可以的!
要不这样,你运行two.jsp就可以!很简单!
举例说明include的工作原理:<br>
this is a1=<%=request.getParameter("a1")%><br>
this is a2=<%=request.getParameter("a2")%><br>
<%out.println("hello from two.jsp");%>
<html>
<body>
<%@ include file="static.html" %>
<%//只是把文件包含进来%>
<a href="two.jsp">goto two--></a><br>
this examples show include works
<jsp:include page="two.jsp" flush="true">
<jsp:param name="a1" value="<%=request.getParameter("name")%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")%>"/>
</jsp:include>
</body>
</html>估计在static.html中name 和 password没提交,就出错了。
我改成这样都没错
<jsp:param name="a1" value=""/>
<jsp:param name="a2" value=""/>有高手看看么,哎,我每个问题到这都问不清楚。
Error: 500
Location: /test/jsp_include.jsp
Internal Servlet Error:org.apache.jasper.compiler.ParseException: C:\jakarta-tomcat-3.3.2\webapps\test\jsp_include.jsp(8,57) Attribute name has no value
at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:485)
......主要是这条 Attribute name has no value谁知道为什么啊?解释不清楚。
<jsp:param name="a1" value="<%=request.getParameter("name")?null%>"/>
<jsp:param name="a2" value="<%=request.getParameter("password")==null?"":request.getParameter("password")%>"/>