【发布时间】:2011-07-01 02:18:33
【问题描述】:
我有以下代码可以正常使用 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);
}
【问题讨论】:
标签: spring request restful-url mapping