为什么不会返回错误的提示框,比如用户名为空的
为什么不会返回错误的提示框,比如用户名为空的应该返回一个提示框才对呀,帮忙
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!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=gb2312">
<meta http-equiv="refresh" content="3;url=denglu.jsp">
<title>无标题文档</title>
<%
request.setCharacterEncoding("gb2312");
String url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Tomcat4\\webapps\\ROOT\\web1\\web\\db1.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(url);
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
//ResultSet rs=st;
String errmsg="错误!";
boolean founderr=false;
String name=errmsg;
String userpassword=errmsg;
String reuserpassword=errmsg;
if(request.getParameter("name").equals("")){
errmsg=errmsg+"用户名不能为空,";
founderr=true;
}else name=request.getParameter("name");
if(request.getParameter("userpassword").equals("")){
errmsg=errmsg+"密码不能为空,";
founderr=true;
}else userpassword=request.getParameter("userpassword");
if(request.getParameter("reuserpassword").equals("")){
errmsg=errmsg+"密码确认不能为空,";
founderr=true;
}else reuserpassword=request.getParameter("reuserpassword");
if(!userpassword.equals(reuserpassword)){
errmsg=errmsg+"两次密码不同!";
founderr=true;
}
String funtion=request.getParameter("funtion");
String partment=request.getParameter("partment");
String sql="select * from user where name='"+name+"'";
ResultSet rs=st.executeQuery(sql);
if(rs.next()){
errmsg=errmsg+"用户名已被别人注册";
founderr=true;
}
else
if(founderr==false) {
String sql1="insert into user(name,password,partment,funtion)values('"+name+"','"+userpassword+"','"+partment+"','"+funtion+"')";
st.executeUpdate(sql1);
}
st.close();
con.close();
%>
</head>
<body>
<!--<jsp:forward page="denglu.jsp">
</jsp:forward> -->
</body>
</html>