@RequestMapping(value = "/joinAccount.do", method = RequestMethod.POST)
public String joinAccount(Account aInfo, HttpServletRequest request, HttpServletResponse response) {
PrivateKey key = (PrivateKey) request.getSession().getAttribute("RSAprivateKey");
if (key != null) {
request.getSession().removeAttribute("RSAprivateKey");
}
try {
String id = rsautil.decryptRsa(key, aInfo.getId());
String s_passwd = rsautil.decryptRsa(key, aInfo.getS_passwd());
String nickname = rsautil.decryptRsa(key, aInfo.getNickname());
String name = rsautil.decryptRsa(key, aInfo.getName());
String phone1 = rsautil.decryptRsa(key, request.getParameter("phone1"));
String phone2 = rsautil.decryptRsa(key, request.getParameter("phone2"));
String phone3 = rsautil.decryptRsa(key, request.getParameter("phone3"));
String phone = String.format("%s-%s-%s", phone1, phone2, phone3);
aInfo.setId(id);
aInfo.setS_passwd(s_passwd);
aInfo.setNickname(nickname);
aInfo.setName(name);
aInfo.setPhone(phone);
// 비밀번호 sha256암호화
aInfo.convertPasswd(s_passwd);
int accnt_id = aService.joinMember(aInfo);
if (accnt_id > 0) {
aService.getAccntInfoByAccntId(aInfo);
}else {
// 회원가입 실패시
System.out.println("회원가입 실패");
return "account/joinFail";
}
} catch (Exception e) {
e.printStackTrace();
}
return "account/joinSuccess";
}
이렇게 회원가입을 진행한다면 성공시에 joinSucess.jsp페이지로 넘어가지만
url은 localhost/joinAccount.do 이렇게 지정되잖아요??
이때 새로고침을 하게되면 데이터가 두번 입력되는거잖아요?
이건 포워드 방식이라고 하더라구요.. 그래서 redirect 방식으로 변경해줘야 url이 바뀐다고 하던데
redirect 방식으로 joinSuccess 페이지를 불러오고 싶은데 어떻게 해야하나요??
joinSuccess.jsp는 views 폴더안에 account폴더안에 있습니다.