当前位置: 代码迷 >> Java Web开发 >> 急 jsp高手回答
  详细解决方案

急 jsp高手回答

热度:8648   发布时间:2013-02-25 21:06:12.0
急急急 在线等jsp高手回答
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="bookshop.util.*" %>
<%@ page session="true" %>
<jsp:useBean id="user" scope="page" class="bookshop.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="/bookshop/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 type="text" name="username" maxlength="20" size="14" >
        </td>
      </tr>
      <tr> 
        <td width="171" align="right">密码:</td>
        <td width="272">
          <input type="password" name="passwd" maxlength="20" size="14">
        </td>
      </tr>
      <tr> 
        <td width="171" align="right">确认密码:</td>
        <td width="272">
          <input type="password" name="passconfirm" maxlength="20" size="14">
  相关解决方案