<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<form:form action="${root }user/modify_pro" method="post" modelAttribute="modifyUserBean">
<form:hidden path="userIdChecked" value="true"/>
<div class="form-group">
<form:label path="user_name">이름</form:label>
<form:input path="user_name" class="form-control" readonly="true" />
</div>
<div class="form-group">
<form:label path="user_id">아이디</form:label>
<form:input path="user_id" class="form-control" readonly="true" />
</div>
<div class="form-group">
<form:label path="user_pw">비밀번호</form:label>
<form:input path="user_pw" class="form-control" showPassword="true" />
<form:errors path='user_pw' style='color:coral'/>
</div>
<div class="form-group">
<form:label path="user_pw2">비밀번호 확인</form:label>
<form:input path="user_pw2" class="form-control" showPassword="true" />
<form:errors path="user_pw2" style="color:coral" />
</div>
<div style="color:coral">${msg }</div>
<div class="form-group">
<div class="text-right">
<form:button class="btn btn-primary">정보수정</form:button>
</div>
</div>
</form:form>
//회원수정 만들기
@GetMapping("/modify")
public String modify(@ModelAttribute("modifyUserBean")UserBean modifyUserBean) {
//현재 로그인중 loginUserBean에서 아이디와 이름값을 얻어 modifyUserBean에 넣기
userService.getModifyUserInfo(modifyUserBean);
return "user/modify";
}
@Select("select user_id, user_name " +
"from user_table " +
"where user_idx = #{user_idx}")
UserBean getModifyUserInfo(int user_idx);
//현재 로그인중인 유저의 인덱스번호로 아이디와 이름을 얻어서 modifyUserBean 객체에 저장
public void getModifyUserInfo(UserBean modifyUserBean) {
UserBean temp = userMapper.getModifyUserInfo(loginUserBean.getUser_idx());
modifyUserBean.setUser_id(temp.getUser_id());
modifyUserBean.setUser_name(temp.getUser_name());
modifyUserBean.setUser_idx(temp.getUser_idx());
}
내가 로그인한정보가 제대로 나오는걸 볼 수 있다.