求教一个servlet结果返回问题
下面是第一个servlet代码:::::
package com.gem.servlet.day3;
import
java.io.IOException;
import java.io.PrintWriter;
import
javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Login1Servlet1 extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws
ServletException,
IOException {
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
String name = request.getParameter("userName");
String password = request.getParameter("pwd");
Userdao userDao = new UserdaoI();
User user = userDao.login(name, password);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD>");
out.println("</head>");
out.println(" <BODY>");
if(user == null){
out.println("用户名或密码错误");
out.println("<a href='login.html'>重新登陆</a>");
}else{
out.println("<form>");
out.println("<input type='button' value='课程信息表管理' onclick=\"location.href('Course.jsp')\">");
out.println("</form>");
}
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}这段是登陆成功后到一个servlet页面,通过点击“课程信息表管理“这个button到一个jsp页面,就是下面这段代码
。。。。。。。。。。。。。。。。。。。。。。。。。。。
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@page import="java.sql.ResultSet"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'shuru.jsp' starting page</title>
<script language="javascript">
function fc(thisurl){
window.open(thisurl) ;
window.close();
window.opener.location.reload();
}
</script>
<script language="javascript">
function fu(){
var s=document.shuru.courid.value;
var s1=document.shuru.courname.value;
var s2=document.shuru.courcredit.value;
var s3=document.getElementById("stusex").value;
var s4=document.getElementById("stusex1").value;
if(s==""||s1==""||s2==""||s3==""||s4==""){
alert("请输入完整信息");
}else if(!/^[0-9]*$/.test(s)){
alert("请输入数字"