views:

80

answers:

1

I have like 20+ forms which are linked from the same page. Some forms share the same controller, while others use their own. For example, form A, B, and C use DefaultController, while form D uses ControllerD. What I would like to achieve is to map the URL to each form in a consistent way. So, ideally, the link page would look like either this:

<a href="/formA.html>Form A</a>
<a href="/formB.html>Form B</a>
<a href="/formC.html>Form C</a>
<a href="/formD.html>Form D</a>

or this:

<a href="/form.html?name=A>Form A</a>
<a href="/form.html?name=B>Form B</a>
<a href="/form.html?name=C>Form C</a>
<a href="/form.html?name=D>Form D</a>

The question is how to map each URL to the appropriate controller. With the first URL pattern, you would map formD.html to ControllerD, but not sure how to map form[A|B|C].html to DefaultController. With the second URL pattern, I don't even know where to begin...

Has anyone done something like this?

A: 

request mapping with annotations

http://static.springsource.org/spring/docs/3.0.0.RELEASE/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-ann-requestmapping-advanced

Aaron Saunders
Thanks, but I was looking for an annotation-based solution...
Tom Tucker