@RequestMapping("/{siteTp}/test/selectTestList.do")
public String selectTestList(HttpServletResponse response,HttpServletRequest request,
@PathVariable("siteTp") String siteTp,ModelMap model) throws Exception{
tmpPage = "/"+siteTp+"/test/testList";
// @PathVariable 을 이용하여 REST 방식의 url을 적용
//Rest 방식으로 url을 지정할 경우에
//게시판의 경우 http://~/board/[관리자ID]/[게시물ID] 호출하면 내용을 볼 수 있도록 될 것입니다.
//컨텐츠 관리의 경우 http://~/contents/[컨텐츠ID] 호출하면 내용을 볼 수 있도록 될 것입니다.
수정된 소스 부분
1. spring-context.xml 추가
<!-- 어노테이션 스캔 설정-->
<context:component-scan base-package="*" />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:alwaysUseFullPath="true" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" p:alwaysUseFullPath="true" />
2. springmvc-context.xml
// 인터셉터 추가
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="alwaysUseFullPath" value="true" />
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor" />
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
<property name="alwaysUseFullPath" value="true" />
</bean>
3. web.xml 추가
<filter-mapping>
<filter-name>authenticationFilter</filter-name>
<url-pattern>*.do</url-pattern>
<url-pattern>*.jsp</url-pattern>
<url-pattern>/board/*</url-pattern>
</filter-mapping>
<!-- 스프링 mvc 적용 URL -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
<url-pattern>*.static</url-pattern>
<url-pattern>/board/*</url-pattern>
</servlet-mapping>
4. @Controller (kr.test.you.board.web.BoardCtrl) 함수
@RequestMapping(value = "/board/view/{manageIdx}/{boardIdx}")
public ModelAndView boardView1(@PathVariable("manageIdx") String manageIdx, @PathVariable("boardIdx") String boardIdx, ModelMap model) throws Exception {
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("boardIdx", boardIdx);
resultMap.put("manageIdx", manageIdx);
String resultURL = "board/view";
return new ModelAndView(resultURL, "resultMap", resultMap);
}