日期:2014-05-18  浏览次数:20624 次

为何JSP页面注册成功仍显示错误提示
注册成功后仍显示:
"注册时出现错误,请稍后再试 "
reg.jsp源码如下:
<%@   page   language= "java "   contentType= "text/html;   charset=GB2312 "   pageEncoding= "GB2312 "%>
<%@   page   session= "true "   %>
<jsp:useBean   id= "user "   scope= "page "   class= "goodsshop.run.op_user "   />
<%
String   mesg   =   " ";
String   submit   =   request.getParameter( "Submit ");
if   (submit!=null   &&   !submit.equals( " "))   {
if(user.add(request)){
session.setAttribute( "username ",user.getUserName());
session.setAttribute(   "userid ",   Long.toString(   user.getUserid()   )   );
response.sendRedirect( "info.jsp?action=regok ");
}   else   if   (!user.getMessage().equals( " "))   {
mesg   =   user.getMessage();
}   else
mesg   =   "注册时出现错误,请稍后再试 ";
}


%>
<script   language= "javascript ">

function   openScript(url,name,   width,   height){
var   Win   =   window.open(url,name, 'width= '   +   width   +   ',height= '   +   height   +   ',resizable=1,scrollbars=yes,menubar=no,status=yes '   );
}

function   checkform()   {
if   (document.form1.username.value== " "){
alert( "用户名不能为空 ");
document.form1.username.focus();
return   false;
}
if   (document.form1.passwd.value== " "){
alert( "用户密码不能为空 ");
document.form1.passwd.focus();
return   false;
}
if   (document.form1.passwd.value!=document.form1.passconfirm.value){
alert( "确认密码不相符! ");
document.form1.passconfirm.focus();
return   false;
}

return   true;
}

</script>
<%@include   file= "/inc/head.inc "%>
<form   name= "form1 "   method= "post "   action= "reg.jsp ">
    <%if   (!mesg.equals( " "))   out.println( " <p> <font   color=#ff0000> "+   mesg   +   " </font> </p> ");%>
        <table   width= "450 "   border= "0 "   cellspacing= "1 "   cellpadding= "1 "   align=center>
  <tr> </tr>
            <tr>
                <td   colspan= "2 "   align= "center "> <b> <font   color= "#0000FF "> 用户注册 </font> </b> </td>
            </tr>
          <tr> </tr>
            <tr>
                <td   width= "171 "   align= "right "> 用户名: </td>
                <td   width= "272 ">
                    <input