VIEW > Controller > Service > Repository > Mybatis > Repository > Service > Controller > VIEW
//@RequestMapping의 GET, POST버전
@GetMapping("/get")
@PostMapping("/post")
자료 검색 코드
<script type="text/javascript">
function getName() {
const name = document.getElementById('name').value;
document.getElementById('search').href = 'search?title='+name;
if (window.event.keyCode == 13) {
location.href = document.getElementById('search').href;
}
}
</script>
<input id="name" onkeyup="getName();" value="<%=title%>" onfocus="this.select();" autofocus>
<a href="" id="search">검색</a> <br>
MyBatis Mapper파일에서 resultType을 단축어로 사용할 수 있도록 도와주는 config.xml 내부 code
설명
<typeAliases>
<typeAlias type="com.spring.book.vo.BookVO" alias="bookVO"/>
</typeAliases>
위와 같이 설정하면, mapper파일에서 아래와 같이 사용할 수 있다.
<select id="getBookList" resultType="bookVO">
<![CDATA[SELECT * FROM book]]>
</select>