spring 3 mvc requestmapping dynamic param problem

Posted by Faisal khan on Stack Overflow See other posts from Stack Overflow or by Faisal khan
Published on 2011-02-21T07:04:22Z Indexed on 2011/02/21 7:25 UTC
Read the original article Hit count: 317

Filed under:
|
|
|

I have the following code which works fine with http://localhost:8080/HelloWorldSpring3/forms/helloworld

but i want to have url have some thing like this

http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here

I found that adding this @RequestMapping("/helloworld/**") will work but when i try to access

http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here

it is not found.

Web.xml entry as follows

<servlet-mapping>
      <servlet-name>dispatcher</servlet-name>
      <url-pattern>/forms/*</url-pattern>
    </servlet-mapping>

Mapping bean entry

@RequestMapping("/helloworld/**")
       public ModelAndView helloWord(){
              String message = "Hello World, Spring 3.0!";
              return new ModelAndView("helloworld", "message",message);
       }

© Stack Overflow or respective owner

Related posts about spring

Related posts about request