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

📄 myinfo.jsp

📁 一个用JSP做成的BBS
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="incdb.jsp"%>
<jsp:useBean id="user" class="test.bbsuser" scope="page"/>
<%
String strSQL;//                       '执行的SQL语句
java.sql.ResultSet sqlRst;				   //'ADODB RECORDSE 对象
java.sql.ResultSet sqlRst2;				   //'ADODB RECORDSE 对象
int i,pages;
String errmsg,username,tempSTR;

errmsg=request.getParameter("errmsg");
if (errmsg==null){
  errmsg="";
}

tempSTR=request.getParameter("pages");
if (tempSTR==null){
 pages=3;
}
else
{
 pages=java.lang.Integer.parseInt(tempSTR);
}
//'
//'
//'pages=1  修改个人信息
//'pages=2  更改个人密码
//'pages=3  查询个人信息
//'
//'
%>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<link rel="stylesheet" type="text/css" href="bbs03.css">

<script Language="JavaScript">
<!--
function isspacestring(mystring)
//是否为空格字符串;true为空,FALSE为非空
{ var istring=mystring;
  var temp,i,strlen;
  temp=true;
  strlen=istring.length;
  for (i=0;i<strlen;i++)
  {
    if ((istring.substring(i,i+1)!=" ")&(temp))
     { temp=false;  }
  }
 return temp;
}

function firstisspace(mystring)
//检查首字母是否是空格,TRUE首字母为空格;FALSE首字母不为空格
{ var istring=mystring;
  var temp,i;
  temp=true;
    if (istring.substring(0,1)!=" ")
     { temp=false;  }
 return temp;
}

function check_input(theForm)
{
      if ((theForm.username.value =="")|(isspacestring(theForm.username.value)))
      {
        alert("请输入用户名!");
        theForm.username.focus();
        return (false);
      }
      
      if ((theForm.userpassword.value =="")|(isspacestring(theForm.userpassword.value)))
      {
        alert("请输入旧密码!");
        theForm.userpassword.focus();
        return (false);
      }


      if ((theForm.newpwd.value =="")|(isspacestring(theForm.newpwd.value)))
      {
        alert("请输入新的密码!");
        theForm.newpwd.focus();
        return (false);
      }
 


     if ((theForm.newpwd.value !=theForm.newpwd2.value))
      {
        alert("两次密码不相同!请重新输入密码.");
        theForm.newpwd.focus();
        return (false);
      }

      if (theForm.newpwd.value.length > 10)
      {
        alert("密码太长了,请重新输入.");
        theForm.newpwd.focus();
        return (false);
      }
       return (true);
}
-->
</script>

</head>

<body>

<table border="1" width="100%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0">
  <tr>
    <td width="34%" bgcolor="#000080" align="center"><a href="myinfo.jsp?pages=1" target="_self"><font color="#FFFFFF">修改个人信息</font></a></td>
    <td width="33%" bgcolor="#000080" align="center"><a href="myinfo.jsp?pages=2" target="_self"><font color="#FFFFFF">更改个人密码</font></a></td>
    <td width="33%" bgcolor="#000080" align="center"><a href="myinfo.jsp?pages=3" target="_self"><font color="#FFFFFF">查询个人信息</font></a></td>
  </tr>
  <tr>
    <td width="100%" colspan="3">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="34%" valign="top">
<!------------------------------------------------------------------------->
<%
if (pages==1) {
//'pages=1  修改个人信息
%>
            <form method="POST" action="userinfo.jsp">
              <p><%=errmsg%><br>
              用户:<input type="text" name="username" size="15"><br>
              密码:<input type="password" name="userpassword" size="10"></p>
              <p align="center"><input class="buttonface" type="submit" value="确定" name="B1">&nbsp;                              
              <input class="buttonface" type="reset" value="重写" name="B2"></p>                             
              <input type="hidden" name="method" value="3">                            
            </form>                            
<%} //'End if%>                            
<!------------------------------------------------------------------------->          </td>                            
          <td width="33%" valign="top">                            
<!------------------------------------------------------------------------->                                      
<%if (pages==2) {
//'pages=2  更改个人密码                           
%>                            
            <form method="POST" action="userinfo.jsp" onSubmit="return check_input(this)" name="form1"><%=errmsg%><br>                    
              <p>用&nbsp;&nbsp;&nbsp; 户:<input type="text" name="username" size="15"><br>                               
              旧的密码:<input type="password" name="userpassword" size="10"><br>                               
              新的密码:<input type="password" name="newpwd" size="10"><br>                               
              确认密码:<input type="password" name="newpwd2" size="10"></p>                               
              <p align="center"><input class="buttonface" type="submit" value="确定" name="B1">&nbsp;&nbsp;                              
              <input class="buttonface" type="reset" value="重写" name="B2"></p>                              
              <input type="hidden" name="method" value="2">                             
            </form>                             
<%}  //'End if%>                            
<!------------------------------------------------------------------------->          </td>                             
          <td width="33%"  valign="top">                             
<!------------------------------------------------------------------------->                            
<%if (pages==3) {                           
//'pages=3  查询个人信息                           
%>                            
            <form method="POST" action="userinfo.jsp">                             
              <p align="center"><%=errmsg%><br>                            
              用户名:<select size="1" name="username">           
<%           
sqlRst=user.listUser(1);

i=1;
String sel;
while (sqlRst.next()) {

  if (i==1) {
    sel="selected";
  }  
  else {
    sel="";
  }
  username=sqlRst.getString("username");
%>                         
                <option value="<%=username%>" <%=sel%>><%=username%></option>           
<%
i++;
}
sqlRst.close();
%>           
              </select><br>                           
              <br>                            
              <input class="buttonface" type="submit" value="确定" name="B1">&nbsp;&nbsp; <input class="buttonface" type="reset" value="重写" name="B2"></p>                              
              <input type="hidden" name="method" value="1">                             
            </form>                             
<%}  //'End if%>                            
<!------------------------------------------------------------------------->                            
          </td>                             
        </tr>                             
      </table>                             
    </td>                             
  </tr>                             
</table>                             
                             
</body>                             
                             
</html>                             

⌨️ 快捷键说明

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