0
は、ここで私のsearchVOフォームでキーワードを検索して値を取得するにはどうすればよいですか?
public class SearchVO {
String keyword="default";
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
}
であると私はSearchVO値Iは、ボタンをクリックするたびに設定したいです。
<div class="wrap bordWrap">
<form commandName="SearchVO" id="appList" name="appList"
action="/index2.do" method="post">
First name: <input type="text" name="fname">
<br>
Last name: <input type="text" name="lname">
<br>
<td colspan="5"><input type="text" class="appNameID" title=""
value="${SearchVO.keyword} " name="searchKeyword" placeholder="ID 또는 앱 이름을 입력하세요." /></td>
<p>
<button value="Search" onclick="formSubmit()">검색</button>
</p>
</form>
</div>
それは私がちょうどsearchVoとしてcommnadNameを設定し、検索キーワードを設定することはできますか?
と私の質問は、コントローラから値を取得する必要がありますか?
@RequestMapping("/index2.do")
public String list(ModelMap model,HttpServletRequest request,
@ModelAttribute("SearchVo")SearchVO searchVo){
System.out.println("index2");
System.out.println(searchVo.getKeyword());
System.out.println(request.getAttribute("searchKeyword"));
return "index";
}