meshjo_12
2023. 11. 7. 23:56
2023. 08.30 수업 이슈
- BeanNameViewResolver
- SpringMVC에서 비동기통신 사용하기
▶ MyBatis 문법
<!-- string붙이고 싶으면 '||' 사용 -->
<select id="searchByPublisher" parameterType="string" resultType="book">
<include refid="select-book" />
WHERE publisher LIKE '%' || #{VALUE} || '%'
</select>
<!-- 부등호 '<' 쓰면 태그로 인식해서 오류난다. -->
<select id="searchByPrice" parameterType="string" resultType="book">
<include refid="select-book" />
WHERE price <#{VALUE}
</select>
<!-- CDATA 사용 -->
<select id="searchByPrice" parameterType="string" resultType="book">
<include refid="select-book" />
<![CDATA[
select *
from employees
WHERE price <= #{VALUE}
]]>
</select>
▶ InternalResourceViewResolver vs BeanNameViewResolver
- 비동기 통신은 InternalResourceViewResolver사용 불가. BeanNameViewResolver를 사용해야 한다. 생각해보면 비동기 통신은 페이지 반환되지 않는다. 그래서 BeanNameViewResolver 을 사용해야 함.
- 비동기에만 쓰도록 한다. 그냥 BeanNameViewresolver쓰지 말고 결과페이지에 full path를 적는다.
- name=”order”로 결과페이지 찾을 때, 우선순위 대로 찾아서 결과페이지를 반환한다.