Unable to pass attribute from controller to view

Posted by MDS on Stack Overflow See other posts from Stack Overflow or by MDS
Published on 2010-06-03T15:41:37Z Indexed on 2010/06/03 15:44 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

I'm using Spring MVC 3 for a web app. In the app a URI template is supposed to be handled by a controller method, which then passes an attribute to a view. Currently, the controller does handle the request, and it even forwards to the correct view. However, it does NOT pass the attribute to the view. Below are the URI template, controller method and relevent jsp tags. Anyone see what is wrong?

URI:

/home/{status}

Controller:

@RequestMapping("/home")
@Controller
public class HomeController {
...
...
@RequestMapping(value="/{status}") 
public String homeStatusView(@PathVariable("status") String status, ModelMap model) {
model.addAttribute("status", status);
return "home";
}
}

JSP:

...
<c:if test="${not empty status}">
<span class="status">Your status is available...</span>
</c:if>
...

© Stack Overflow or respective owner

Related posts about java

Related posts about mvc