검색 기능을 구현하다 값 넘기는 문제 때문인지 막혀서 질문 드립니다 ㅠㅠ
view.jsp 에서 value를 설정해줘야 하는것인지..
어디가 문제인지 감이 잘 안옵니다ㅠ
검색 폼 view.jsp
```
<form class="form-inline" action="<c:url value='/users/searchUser' />" method="get">
<label class="control-label">Search </label>
<input name="nickName" type="text" class="form-control" placeholder="NickName">
<button type="submit" class="btn btn-md btn-default">Search</button>
<sec:csrfInput />
</form>
```
controller.java
```
@RequestMapping(value ="/users/searchUser", method = RequestMethod.GET)
public String getSearchUser(@ModelAttribute String nickName, Model model){
List<UserVO> getUser = userMapper.getSearchUser(nickName);
model.addAttribute("getUser", getUser);
System.out.println(getUser.toString());
return "users/searchUser";
}
```
mapper.java
```
@Select("SELECT UserIdx, NickName, LastLogin, CreateDate, Tutorial, NationCode,"
+ " CASE WHEN CharacterType = 1 THEN 'Poong' ELSE 'Myoung' END AS CharacterType,"
+ " CASE WHEN OS = '1' THEN 'Android' ELSE 'IOS' END AS OS"
+ " FROM tbl_user WHERE NickName = '#{nickName}'")
public List<UserVO> getSearchUser(String nickName);
```
sehongpark님의 답변
# 모델어트리뷰트 파라메터를 바꿔주세요
변경전
```java
@RequestMapping(value ="/users/searchUser", method = RequestMethod.GET)
public String getSearchUser(@ModelAttribute String nickName, Model model){
...
}
```
변경후
```java
@RequestMapping(value ="/users/searchUser", method = RequestMethod.GET)
public String getSearchUser(@ModelAttribute UserVO user, Model model){
String nickName = user.getNickName();
List<UserVO> getUser = userMapper.getSearchUser(nickName);
model.addAttribute("getUser", getUser);
System.out.println(getUser.toString());
return "users/searchUser";
}
```