我在web.xml里面定义多个dispatch-servlet的前缀映射,像下面这样
在controller里面分别有对应的controller
当有多个前缀映射的时候,springmvc就不认得了?
看起来像前缀映射时springmvc取得的参数是url-pattern里面的*的部分。
盼高手解决,谢谢
<!-- Servlets -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/guestbook/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/note/*</url-pattern>
</servlet-mapping>
在controller里面分别有对应的controller
@Controller
@RequestMapping(value = "/note")
public class Note {
@RequestMapping(value = "/show", method = RequestMethod.GET)
public String show(Model model) {
return "note/show";
}
...
}
@Controller
@RequestMapping(value = "/guestbook")
public class Note {
@RequestMapping(value = "/show", method = RequestMethod.GET)
public String show(Model model) {
return "guestbook/show";
}
...
}
当有多个前缀映射的时候,springmvc就不认得了?
看起来像前缀映射时springmvc取得的参数是url-pattern里面的*的部分。
盼高手解决,谢谢