컨트
@PostMapping("LoginPro")
@ResponseBody
public ResponseEntity<?> loginPro(String member_id, MemberVO member, @RequestParam(required = false) boolean rememberId,
HttpSession session, HttpServletResponse response, Map<String, Object> resultMap) {
~ 로그인 처리 코드
Cookie cookie = new Cookie("cookie_member_id", member.getMember_id());
if (rememberId) { // 아이디 저장 체크됨
cookie.setMaxAge(60 * 60 * 24 * 30);
} else { // 아이디 저장 미체크
cookie.setMaxAge(0); // 쿠키 즉시 삭제한다는 의미
}
response.addCookie(cookie);
resultMap.put("status", "success");
return ResponseEntity.status(HttpStatus.OK).body(resultMap);
}
jsp
<input class="user" type="text" name="member_id" id="id" value="${cookie.cookie_member_id.value }" style="align-content: center" placeholder="아이디">
<input class="pass" type="password" name="member_passwd" id="passwd"style="align-content: center" placeholder="비밀번호">
<div class="privateCheck">
<input type="checkbox" name="rememberId" id="rememberId" ${empty cookie.cookie_member_id.value ? "": "checked"} >
<a>아이디 저장</a>
</div>

















댓글 ( 4)
댓글 남기기