Question

I'm facing a little problem with my SiteMesh template using Spring MVC. I've configured it all so it works fine and it decorates my views. But my issue is that I want to add the menu and possibly menu-specific logic such as highlight active page etc. I naively added my menu to my master.jsp page (which is my SiteMesh template) but the links are jsp tags that need to be evaluated and they just aren't.

Here's my template: master.jsp

<%@ taglib prefix="decorator"
uri="http://www.opensymphony.com/sitemesh/decorator"%>

<html>
<head>
    <title><decorator:title /></title>
</head>
<body>
    <div id="header">
        <h1>header</h1>
    </div>
    <div id="menu">
        <ul class="well nav nav-list">
            <li><a href="#">Home</a></li>
            <li><a href="<c:url value="/assignments/"/>">Assignments</a></li>
            <li><a href="<c:url value="/contractExtensionRequests/"/>">Contract extension requests</a></li>
            <li><a href="<c:url value="/resourceRequests/"/>">Resource requests</a></li>
            <li><a href="<c:url value="/clients/"/>">Clients</a></li>
            <li><a href="<c:url value="/resources/"/>">Resources</a></li>
            <li><a href="<c:url value="/departments/"/>">Departments</a></li>
            <li><a href="<c:url value="/projects/"/>">Projects</a></li>
        </ul>
    </div>
    <div id="main">
        <decorator:body />
    </div>
    <div id="footer">
        <h1>footer</h1>
    </div>
</body>
</html>

Nothing exceptional (to my understanding) but the <a>'s href attribute are just rendered as plain text and aren't evaluated as JSP tags. I understood that SiteMesh just takes the output of Spring MVC and then decorates it, this probably being the reason of the problem.

But if that isn't the way to do it, how can I add a menu that would first be evaluated by Spring MVC and added as decoration by SiteMesh? And in a more way, is it possible to have SiteMesh's template evaluated by Spring MVC?

Thank you!

Was it helpful?

Solution

Try to add this declaration on the top:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top