Announcement Announcement Module
Collapse
No announcement yet.
Sitemesh and Spring MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sitemesh and Spring MVC

    Just currious if there are any good step by step exampls on how to implement sitemesh and spring. I seen some on freemaker and velosity, but i dont want to use any of those (for now), only confuse me more. I'm a sitemesh newbee, and i done a simple try, but i keep getting a blank page.

    Here are some config:
    /WEB-INF/web.xml
    Code:
    	</context-param>
    
    	<filter>
    		<filter-name>sitemesh</filter-name>
    		<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>sitemesh</filter-name>
    		<url-pattern>/*</url-pattern>
    		<dispatcher>REQUEST</dispatcher>
    		<dispatcher>FORWARD</dispatcher>
    	</filter-mapping>
    
    	<servlet>
    /WEB-INF/decorators.xml
    Code:
    <decorators defaultdir="/decorator">
    
    	<decorator name="default" page="/mydec.jsp">
    		<pattern>/*</pattern>
    	</decorator>
    	
    </decorators>
    /decorator/mydec.jsp
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<title>My Site - <decorator:title default="Welcome" /></title>
    		<decorator:head />
    	</head>
    	<body>
    		<decorator:body />
    	</body>
    </html>
    And my pages worked before i applied the filter

    -Erik

  • #2
    Have a look at the project by Matt Raible. He also uses sitemesh. I found it very easy to use his create new project scripts. You get acegi etc for free :-)

    https://equinox.dev.java.net/

    Comment


    • #3
      As for blank page, do you have anything in your logs?

      Comment


      • #4
        I do noet see anything in the log that would point to sitemesh being used.

        There is one thing that grabs my attention, where is your file mydec.jsp. I take it, you placed it in the decorator directory like you write above the pice of code. Then my best bet is that you must be using this line in your decoratos.xml file:

        Code:
        <decorators defaultdir="/decorator">
        
        	<decorator name="default" page="mydec.jsp">
        		<pattern>/*</pattern>
        	</decorator>
        	
        </decorators>
        do mind the / in front of te jsp.

        hope that helps

        Comment


        • #5
          Thanks a million Jettro!

          Just removed the / and it worked.

          Now i can start focus on how to use it the best way

          -Erik

          Comment

          Working...
          X