我有以下代码可以很好地与 http://localhost:8080/HelloWorldSpring3/forms/helloworld
但我想让 url 有这样的东西
http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here
我发现添加这个 @RequestMapping("/helloworld/**") 会起作用,但是当我尝试访问时
http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here
没有找到。
web.xml 入口如下
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/forms/*</url-pattern>
</servlet-mapping>
映射 bean 条目
@RequestMapping("/helloworld/**")
public ModelAndView helloWord(){
String message = "Hello World, Spring 3.0!";
return new ModelAndView("helloworld", "message",message);
}