regsubmit.jsp

来自「JSP+ORACLE网站开发实例(下).rar」· JSP 代码 · 共 64 行

JSP
64
字号
<%@ include file="conn.jsp"%>
<%request.setCharacterEncoding("GB2312");
String user_name =request.getParameter("user_name");
password = request.getParameter("password");
if(password==null){
	out.print("数据有错!");
}else{
  String sql="select * from scott.user_reg where user_name='"+user_name+"'"; 
ResultSet rs=stmt.executeQuery(sql); 
   if(!rs.next()){
stmt.executeUpdate("INSERT INTO scott.user_reg(user_id,user_name,password) VALUES(scott.user_regid.nextval,'"+user_name+"','"+password+"')");

String sql1="select * from scott.user_reg where user_name='"+user_name+"' "; 
ResultSet rs1=stmt.executeQuery(sql1); 
   if(rs1.next()){
session.putValue("user_id", rs1.getString("user_id")); 
response.sendRedirect("regok.jsp");  
   }
   
   }else{
%>
<html>
<head>
<style>
<!--
tr           { font-size: 10pt }
body         { font-size: 10pt }
a:link       { color: blue; text-decoration: none }
a:visited    { color: blue; text-decoration: none }
a:active     { color: #ff9966; text-decoration: none }
a:hover      { color: red; text-decoration: none }
.aa {  font-size: 10pt; line-height: 15pt; text-decoration: none}
-->
</style>
</head>
<body>
<div align="center">
  <center>
<table border="0" width="400" cellspacing="0" cellpadding="0">
      <tr align="center"> 
        <td width="100%" height="25"><b><font color="#008000" size="3">必填栏目发现问题</font></b></td>
  </tr>
</table>
  </center>
</div>
<div align="center">
  <center>
  <table border="1" width="400" bordercolor="#336699" cellspacing="0" cellpadding="5">
    <tr>
      <td width="100%">
          <ul class="aa">
            <li><font color="red">已经有人选择了该<b>用户名称</b></font>。请选择另一个用户名称,可以尝试在要记住的名称结尾添加一个数字。</li>
      </ul>
      </td>
    </tr>
  </table>
  </center>
</div>
<p align="center"><a href="reg.jsp">[重新注册]</a></p>
</body>
</html>
<%}
}%>

⌨️ 快捷键说明

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