tags:

views:

12

answers:

0

Spring MVC is able to convert "path variables" to domain objects using WebDataBinder and PropertyEditorSupport. My question is: Is it able to do the opposite conversion when rendering links in a JSP, too?

My JSP looks like this:

<s:url value="/myaccount/{user}" var="url">
    <s:param name="user" value="${currentUser}" />
</s:url>
<a href="${url}">My Account</a>

It's called by this controller:

@RequestMapping(value="/home")
public String render(final Model model)
{
    model.addAttribute("currentUser", UserModel.getCurrent());
    return "home";
}

The handler is the following:

@RequestMapping(value="/myaccount/{user}")
public String render(@PathVariable UserModel user, final ModelMap model)
{
    // ...
}

But this doesn't work as the JSP doesn't use the PropertyEditorSupport that is applied in the 2nd controller.

Is it possible to get this working?