Restful Path Parameters in Spring MVC 3

Posted by MDK on Stack Overflow See other posts from Stack Overflow or by MDK
Published on 2010-06-01T15:24:36Z Indexed on 2010/06/01 15:53 UTC
Read the original article Hit count: 234

Filed under:
|
|
|

Is it possible to: set a URI template in the mvc:view-controller element of the *-servlet.xml file or in a controller method and then use/get that path parameter in a jsp?

I understand that using @PathVariable in a controller method will give me access to the path parameter in that controller method. But how can I gain access to the path parameter in the jsp?

For example, is it possible to do something like:

*-servlet.xml file:

<beans...>
<mvc:view-controller path="/home" view-name="home"/>
<mvc:view-controller path="/home/{error}" view-name="home"/>
</beans>

jsp file:

<c:if test="${not empty param['error']}">
<span class="error">You have an error...</span>
</c:if>

© Stack Overflow or respective owner

Related posts about java

Related posts about web-development