| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1226 人关注过本帖
标题:归档模式问题
只看楼主 加入收藏
huojian
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-11-5
收藏
 问题点数:0 回复次数:0 
归档模式问题
<%@page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.regex.Matcher"%>
<%@ page import="java.util.regex.Pattern,*"%>
<%@ page import="java.sql.*"%>
<%@ page import="control.database.DataBase"%>
<%@ page import="com.zsoft.webmail.http.HttpUtils"%>
<%@ page import="com.jzst.zzb.*"%>
<html>
<head>
<base target="_self">
<title>更改密码</title>
<LINK href="images/StyleSheet.css" type=text/css rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%
    String loginID = request.getParameter("loginID");
    String areaID = (String) session.getAttribute("areaID");
    String orgID = (String) session.getAttribute("orgID");
    String prodID = (String) session.getAttribute("prodID");
    
    ConfigXml configxml=new ConfigXml();
    String basePath =configxml.getUrlBase();
    //判断session过期
    if (areaID == null || orgID == null || prodID == null) {
        out.println("session已过期,请退出后重新登陆");
        return;
    }
    //判断是否为等待输入页
    String yxmm = request.getParameter("yxmm");
    String qryxmm = request.getParameter("qryxmm");
    String czmm = request.getParameter("czmm");
    String qrczmm = request.getParameter("qrczmm");
    if (yxmm == null && qryxmm==null) {
%>
<script type="text/javascript" language="javascript">
function checkform(){
   var s1 = document.forms[0].yxmm.value;
   var s2 = document.forms[0].qryxmm.value;
                if(s1.length>10) {
                    alert("最多只能输入10位邮箱密码");
                    document.forms[0].yxmm.value="";
                    document.forms[0].qryxmm.value="";
                    document.forms[0].yxmm.focus();
                    return false;
                }
              if(s1.length<6||s1=="") {
                    alert("请输入6到10位邮箱密码");
                    document.forms[0].yxmm.value="";
                    document.forms[0].qryxmm.value="";
                    document.forms[0].yxmm.focus();
                    return false;
                }
                if(s1!=s2)
                {
                   alert("两次输入的邮箱密码不一样");
                   document.forms[0].yxmm.value="";
                   document.forms[0].qryxmm.value="";
                   document.forms[0].yxmm.focus();
                   return false;
                }
    var  s3 = document.forms[0].czmm.value;
    var  s4 = document.forms[0].qrczmm.value;
    if(s3!=""&&s3.length!=6||isNaN(s3))
    {
     alert("传真密码只能输入6位数字");
     document.forms[0].czmm.value="";
     document.forms[0].qrczmm.value="";
     document.forms[0].czmm.focus();
     return false;
    }
    if(s3!=s4)
    {
     alert("两次输入的邮箱密码不一样");
     document.forms[0].czmm.value="";
     document.forms[0].qrczmm.value="";
     document.forms[0].czmm.focus();
     return false;
    }
    if(s1==""&&s3=="")
    {
     alert("密码不能为空");
     document.forms[0].yxmm.focus();
     return false;
    }
    else{
      if((s1==" ">1&&s2>1=="")&&s3!="")
      {
         alert("邮箱密码不能为空格");
         document.forms[0].yxmm.value="";
         document.forms[0].qryxmm.value="";
          return false;
      }
    }
       if((s3==""&&s4=="")&&s1!="")
    {
         return true;
    }
    else{
      if((s3==" ">1&&s4>1=="")&&s1!="")
      {
         alert("传真密码不能为空格");
         document.forms[0].czmm.value="";
        document.forms[0].qrczmm.value="";
          return false;
      }
    }
    if((s1==" ">1&&s2==" ">1)&&s3=="")
    {
       alert("邮箱密码不能为空格");
        return false;
    }
}
</script>
<body>
<form action="ChangePassword.jsp?loginID=<%=loginID%>" method="post">
<!--onsubmit="return checkform()">  -->    
<table width="527" height="160">
    <tr>
        <td>密码修改</td>
    </tr>
    <tr>
        <td width="123"><span>输入邮箱新密码:</span></td>
        <td width="388"><span> <input type="password" name="yxmm">
        <span>*</span>只能输入6到10位数字/字母</span></td>
    </tr>
    <tr>
        <td><span>确认邮箱新密码:</span></td>
        <td><span> <input type="password" name="qryxmm"> <span>*</span>只能输入6到10位数字/字母</span></td>
    </tr>
    <tr>
        <td><span>输入传真新密码:</span></td>
        <td>
        <div align="left"><input type="password" name="czmm">
        只能输入6位数字</div>
        </td>
    </tr>
    <tr>
        <td><span>确认传真新密码:</span></td>
        <td><span> <input type="password" name="qrczmm">
        只能输入6位数字 </span></td>
    </tr>
    <tr>
        <td height="20" colspan="2">
        <div align="center"><input type="submit" value="提交"> <input
            type="reset" name="Submit2" value="重置"></div>
        </td>
    </tr>
</table>
</form>
</body>
<%
    //密码修改页
    } else {
        String outMessage = "";
        //检查邮箱密码
        if (yxmm == null || qryxmm == null) {
            outMessage = "错误:邮箱密码及邮箱确认密码不能为空";
        } else if (!yxmm.equals(qryxmm)) {
            outMessage = "错误:邮箱密码与邮箱确认密码不同";
        } else if (yxmm.length() < 6 || yxmm.length() > 10) {
            outMessage = "错误:邮箱密码长度必须为6-10位";
        }
        //检查传真密码
        if (czmm != null) {
            if (qrczmm == null) {
        outMessage = "错误:传真确认密码不能为空";
            } else if (!czmm.equals(qrczmm)) {
        outMessage = "错误:传真密码与传真确认密码不同";
            } else if (czmm.length() != 6) {
        outMessage = "错误:传真密码长度必须为6位";
            } else {
        try {
            Integer.valueOf(czmm);
        } catch (NumberFormatException e) {
            outMessage = "错误:传真密码必须为数字";
        }
            }
        }
        //输入参数格式正确
        if (outMessage.length()<1) {
            outMessage = "";
            String domainname = "", username = "";
            DataBase db = null;
            PreparedStatement stmt = null;
            ResultSet rs = null;
            try {
                String sqlGetUser = "select username,domainname from kdsw_users where areaID=? and orgID=? and prodID=? and loginID=?";
                db = new DataBase();
                stmt = db.getConnection().prepareStatement(sqlGetUser);
                stmt.setString(1, areaID);
                stmt.setString(2, orgID);
                stmt.setString(3, prodID);
                stmt.setString(4, loginID);
                rs = stmt.executeQuery();
                if (rs.next()) {
                    username = rs.getString(1);
                    domainname = rs.getString(2);        
                }
            } catch (Exception e) {
            } finally {
                if (rs != null)
                    rs.close();
                if (stmt != null)
                    stmt.close();
                if (db != null)
                    db.closeConn();
            }
            //判断用户是否存在
            if(username.length()<1||domainname.length()<1) {
                outMessage = "错误:用户不存在";
            } else {
                String urlChgPwd = basePath+"/ext_jzst_setnamepassword.jsp?username="+username+"&hostname="+domainname+"&password="+yxmm;
                if(czmm!=null) {
                    urlChgPwd = urlChgPwd + "&Ppassword="+czmm;
                }
                //调用URL修改密码
                HttpURLConnection huc = HttpUtils.getConnection(urlChgPwd, null);
                HttpUtils.sendRequest(huc, null);
                String retMsg = HttpUtils.getResponse(huc);
                if (retMsg.equals("return=0;")) {
                    outMessage="密码修改成功";
                } else {
                    outMessage="密码修改失败";
                }
            }
        }
        %>
<body>
    <div align="center">    
    <br><br>
    <br><br>
    <h2><%=outMessage%></h2>
    <br>                                      
    <input type="button" value="返回" onClick="javascript:history.back();">
    <input type="reset" name="button" value="关闭" onclick="window.close()">
    </div>
</body><%} %>
</html>
以上是我通过归档模式打开的网页,这个页里有个提交一点提交就提交到自己,然后显示密码修改成功与失败,里还有一个返回,我想让他一点返回就还显示成修改密码的那个页面,脚本代码怎么写啊,有人告诉我们谢谢了QQ50136164,可以送个杀毒软件
搜索更多相关主题的帖子: import LINK page java 
2008-01-16 18:06
快速回复:归档模式问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031517 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved