关于forward的用法一些问题
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String username = "小明";
%>
<jsp:forward page="forward_demo02.jsp">
<jsp:param name="name" value="<%=username%>" ;/>
<jsp:param name="info" value="info" ;/>
</jsp:forward>
这是第一个forward_demo01.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<h1>
这是跳转之后的页面
</h1>
<h2><%=request.getParameter("name")%></h2>
<h2><%=request.getParameter("info")%></h2>
这是第2个forward_demo02.jsp 我运行之后出现500错误
org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:620)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.ClassNotFoundException: org.apache.jsp.forward_005fdemo01_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:366)
java.net.URLClassLoader$1.run(URLClassLoader.java:355)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:354)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:618)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
这是什么原因?
------解决方案--------------------
是直接粘贴的,去掉了参数后面的分号,第二个jsp名字改了一下而已
------解决方案--------------------
12楼是对的哦,去掉分号就可以的。