Spring URL mapping question

Posted by es11 on Stack Overflow See other posts from Stack Overflow or by es11
Published on 2010-02-18T18:18:18Z Indexed on 2010/05/31 7:32 UTC
Read the original article Hit count: 294

Filed under:
|
|
|

I am using Java with Spring framework. Given the following url:

www.mydomain.com/contentitem/234

I need to map all requests that come to /contentitem/{numeric value} mapped to a given controller with the "numeric value" passed as a parameter to the controller.

Right now in my servlet container xml I have simple mappings similar to the following:

...
<entry key="/index.html">
   <ref bean="homeController" />
</entry>
...

I am just wondering what I need to add to the mapping in order to achieve what I described?

Edit: I unaccepted the answer temporarily because I can't seem to figure out how to do the mapping in my web.xml (I am using annotations as described in axtavt's answer below). How do I add a proper <url-pattern>..</url-pattern> in my <servlet-mapping> so that the request for "/contentitem/{numeric_value}" gets properly picked up? Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about spring