javaBean使用问题,没有转到welcome页面,急!
错误信息:
org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 20 in the jsp file: /welcome.jsp
Generated servlet error:
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
register.jsp如下:
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>模拟注册</title>
</head>
<body>
<form name="form1" method="post" action="welcome.jsp">
<p>班级:
<input name="class" type="text" size="20">
</p>
<p>学号:
<input name="number" type="text" size="20" maxlength="20">
</p>
<p>姓名:
<input name="name" type="text" size="15" maxlength="15">
</p>
<p>籍贯:
<input name="address" type="text" size="20" maxlength="20">
</p>
<p>爱好:
<input name="hoby" type="text" size="15" maxlength="15">
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form>
</body>
</html>
welcom.jsp如下:
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="bean.Student" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>欢迎页面</title>
</head>
<body>
<%!String getClass,getName,getAddress,getNumber,getHoby;%>
<%
getClass = request.getParameter("class");
getNumber =request.getParameter("number");
getName = request.getParameter("name");
getAddress = request.getParameter("address");
getHoby = request.getParameter("hoby");
%>
<jsp:useBean id="SS" scope="session" class="bean.Student"></jsp:useBean>
<%=SS.setClassName("ahhh")%>
<p align="center"><%=getName%>你好!恭喜你已经注册成功!
</p>
<form name="form1" method="post" action="display.jsp">
<div align=&q