當(dāng)幸福來敲門

          我就會牢牢抓住!
          隨筆 - 50, 文章 - 3, 評論 - 8, 引用 - 0
          數(shù)據(jù)加載中……

          關(guān)于登錄界面 記住用戶名和密碼的一段代碼

          Cookie cookies[]=request.getCookies();
              Cookie stCookie=null;
              String password=null;
              String passwordvalue=null;
              String usernamevalue=null;
              String cookiename = null;
              String nameandpassword[]=new String[3];
              if (cookies != null) {
             for (int i = 0; i < cookies.length; i++) {
              stCookie = cookies[i];
              cookiename = stCookie.getName();
              if (cookiename!=null && cookiename.equalsIgnoreCase("db_password")) {
               passwordvalue = stCookie.getValue();
               password = passwordvalue;//.substring(8, passwordvalue.length()-3);
               nameandpassword[1] = password.trim();
              }
              if (cookiename!=null && cookiename.equalsIgnoreCase("db_username")) {
               usernamevalue = stCookie.getValue();
               nameandpassword[0] = usernamevalue.trim();
              }
              }
           }





          <body>
          <p>
                 <label for="LoginName">
                  用戶名 / 郵箱:
                 </label>
                 <input class="text" type="text" id="LoginName" name="LoginName"
                  value="<%=nameandpassword[0]==null?"":nameandpassword[0] %>" />
                </p>
                <p>
                 <label for="Password">
                  密碼:
                 </label>
                 <input class="text" type="password" value="<%=nameandpassword[1]==null?"":nameandpassword[1] %>" name="Password" id="Password" />
                </p>


          </body>

          posted on 2013-11-01 15:08 wyx 閱讀(318) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 久治县| 庐江县| 尚志市| 合作市| 防城港市| 新安县| 阿巴嘎旗| 旺苍县| 灵武市| 巍山| 漳平市| 安义县| 额尔古纳市| 新密市| 永定县| 兴和县| 林西县| 阿荣旗| 比如县| 孝昌县| 吉安县| 葵青区| 丹凤县| 将乐县| 探索| 邵阳市| 呼和浩特市| 新和县| 卢湾区| 宁陵县| 霍城县| 社旗县| 什邡市| 嘉义县| 南开区| 苏尼特右旗| 沂南县| 茌平县| 鄄城县| 呼图壁县| 利辛县|