Announcement Announcement Module
No announcement yet.
Spring MVC - Layout solution Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC - Layout solution

    I'd like to create layout solution in combination with Spring MVC, Web Flow, Security, Data, etc...

    What I've found:

    1. VelocityLayoutViewResolver - possible but I don't like it because in JSP is taglib "spring:" I like so much
    2. Apache Tiles 2 - possible, but I've not really found any usable example how to combine it with JSP

    What I think it should do:

    1. Define default layout in bean config
    2. Override layout in @Controller or @RequestMapping
    3. Simple use

    I'd like to have template like this:

    HTML Code:
    <!-- Should be placed in place for example like WEB-INF/views/layout.jsp -->
            <title> <c:out value="${page_title}"> </title>
            <div header />
            <div content-wrapper>
                <%@include file="${view_name}"%>
            </div content-wrapper>
            <div footer />
    public class PersonController {
        public String index(Map<String, Object> map) {
            // this will mark included view path, can be configurable through prefix/suffix in bean declaration
            // layout will be for example in path: WEB-INF/views/person/index.jsp
            return "person/index.jsp";
    What solution do you think I should use?

  • #2
    Go for tiles. I suggest the tiles website and the tiles reference guide/documentation. It has some samples and tutorials.

    Regarding your controller I suggest only returning person/index to decouple it from the actual view layer.