⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register.jsp

📁 JSP+oracle开发实例精粹》随书光盘
💻 JSP
字号:
<%@ page language="java" contentType="text/html;charset=gbk"%>
<%@ page import="qiuzhi.*"%>
<jsp:useBean id="job" class="qiuzhi.personaljob"/>

<%
	String username = request.getParameter("username");
	if(username == null || username.length() == 0)
	{
%>
<html>
<head>
<title>个人求职管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="../css_js/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
	function confirm()
	{
		if(add_form.username.value.length == 0 || add_form.psw.value.length == 0 || add_form.password.value.length == 0)
		{
			alert("带星号的一定要填写!");
		}
		else
		{
			if(add_form.psw.value != add_form.password.value)
			{
				alert("密码确认不一致!");
			}
			else
			{
				add_form.submit();
			}
		}
	}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0" bgcolor="#30483C">
  <tr> 
    <td width="290" valign="middle"><img src="../ima/title.gif" width="290" height="50" border="0"></td>
    <td align="right" valign="bottom"><font color="#FFFFFF"><strong>新用户注册</strong></font>&nbsp;&nbsp;</td>
  </tr>
</table>
<form name="add_form" method="post" action="register.jsp">
<table width="100%" border="0" cellpadding="1" cellspacing="1">
  <tr>
    <td align="center" valign="top">
	<table width="400" border="0" cellspacing="1" cellpadding="1">
        <tr class="text-login"> 
          <td width="60" height="20">用户名</td>
          <td width="290" height="20"><input type="text" name="username" class="inputlength120">*</td>
        </tr>
        <tr bgcolor="#EEEEEE" class="text-login"> 
          <td width="60" height="20">密码</td>
          <td width="290" height="20"><input type="password" name="password" class="inputlength120">*</td>
        </tr>
        <tr class="text-login"> 
          <td width="60" height="20">确认密码</td>
          <td width="290" height="20"><input type="password" name="psw" class="inputlength120">*</td>
        </tr>
        <tr bgcolor="#EEEEEE" class="text-login"> 
          <td width="60" height="20">姓名</td>
          <td width="290" height="20"><input type="text" name="name" class="inputlength120"></td>
        </tr>
        <tr class="text-login"> 
          <td width="60" height="20">年龄</td>
          <td width="290" height="20"><input type="text" name="age" class="inputlength120"></td>
        </tr>
        <tr bgcolor="#EEEEEE" class="text-login"> 
          <td width="60" height="20">联系电话</td>
          <td width="290" height="20"><input type="text" name="telephone" class="inputlength120"></td>
        </tr>
        <tr class="text-login"> 
          <td width="60" height="20">Email</td>
          <td width="290" height="20"><input type="text" name="email" class="inputlength120"></td>
        </tr>
        <tr bgcolor="#EEEEEE" class="text-login"> 
          <td width="60" height="20">联系地址</td>
          <td width="290" height="20"><input type="text" name="address" class="inputlength120"></td>
        </tr>
		<tr class="text-login"> 
          <td width="60" height="20">用户类型</td>
          <td width="290" height="20">
		  <select name="role" class="inputlength120">
			<option value="0" selected>个人用户</option>
			<option value="1">公司用户</option>
		  </select></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0" bgcolor="#446655">
  <tr> 
    <td width="200" background="ima/pop_bg.gif">&nbsp;</td>
    <td align="right" valign="middle">
	<input name="Button" type="button" class="logbutton" value="注册" onClick="confirm()"><input name="Button" type="button" class="logbutton" value="关闭" onClick="window.close();">&nbsp;&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
<%
	}
	else
	{		
		%>
		<%@ include file="../lib/config.jsp" %>
		<%
		if(!job.init(OracleDriver,OracleUrl,OracleUser,OraclePsw))
		{
		    out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"Fail to Connect Oracle Server!  Please check the settings!\");window.close();</script>");
		}
		else
		{
			username = new String(username.getBytes("ISO8859_1"));
			String password = request.getParameter("password");
			String name = request.getParameter("name");
			name = (name == null ? "" : (new String(name.getBytes("ISO8859_1"))));
			String address = request.getParameter("address");
			address = (address == null ? "" : (new String(address.getBytes("ISO8859_1"))));
			String age = request.getParameter("age");
			age = (age == null ? "0" : age);
			String tel = request.getParameter("telephone");
			tel = (tel == null ? "12345678" : tel);
			String role = request.getParameter("role");
			role = (role == null ? "0" : role);
			userTable utable = new userTable();
			utable.setUsername(username);
			utable.setPassword(password);
			utable.setName(name);
			utable.setAge(age);
			utable.setTelephone(tel);
			utable.setAddress(address);
			utable.setRole(role);
			int re = job.addUser(utable);
			if(re == 1)
			{
				out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"注册成功\");window.close();</script>");
			}
			else
			{
				out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"注册成功\");window.close();</script>");
			}
		}
	}	
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -