728x90
반응형
<%@ page contentType="text/html;charset=utf-8" %>
<html>
<head><title>로그인</title></head>
<%
   Cookie countCook = new Cookie("countCook", "count"); 
    
     
   String ValuelnCookie;
   int count = 1;
   boolean isIDShow = false;
   String id = null;
   Cookie[] cookies = request.getCookies();
      if (cookies != null && cookies.length > 0) {
         for (int i = 0 ; i < cookies.length ; i++) {
      
if (cookies[i].getName().equals("id")) {
                      isIDShow = true;
                      id = cookies[i].getValue();
                  }
    
                            
else {
ValuelnCookie = countCook.getValue();
   count = Integer.parseInt(ValuelnCookie);
            count ++;
ValuelnCookie = Integer.toString(count);
countCook.setValue(ValuelnCookie);
countCook.setMaxAge(10);
countCook.setPath("/");
response.addCookie(countCook); 
         
}
}
}
%>

<body>
관리자 (Master)로 로그인하세요.<br/>

<form action="loginProcess2-lab7.jsp" method="post">
<%
   if (isIDShow) {
%>
ID : <input type="text" name="id" value="<%= id %>">
<input type="checkbox" name="idstore" value="store" checked>아이디 기억하기
</input><br/>
<%
   } else {
%>
ID : <input type="text" name="id">
<input type="checkbox" name="idstore" value="store">아이디 기억하기</input><br/>
<%
   }
%>
Password : <input type="password" name="pw"><br/>
<input type="submit" value="전송">
</body>
</html>


728x90
반응형

'모바일웹 > 쿠키 설정관련' 카테고리의 다른 글

자바스크립트 쿠키에 대해 질문입니다.  (0) 2015.03.31
쿠키 암호화 만료시간갱신 ASP.NET  (0) 2015.03.31
JSP 쿠키, 세션  (0) 2015.03.31
JSP 쿠키  (0) 2015.03.31
쿠키 관련 질답  (0) 2015.03.31
블로그 이미지

nineDeveloper

안녕하세요 현직 개발자 입니다 ~ 빠르게 변화하는 세상에 뒤쳐지지 않도록 우리모두 열심히 공부합시다 ~! 개발공부는 넘나 재미있는 것~!

,