Reputation: 1335
I am implementing sitemesh3 in my spring MVC project and getting 404 exception. I am following this tutorial SiteMesh3 now the problem is I am placing my jsp's inside Web-Inf in view Folder so what path i should give in sitemesh3.xml in decorator tag. I had tried a long but gettting 404 when deployed....
Upvotes: 1
Views: 1785
Reputation: 2242
I successfully managed to make it work sitemesh3 + spring mvc. Decorators can be placed inside WEB-INF without problem
my directory structure is as follow
webapp/WEB-INF$ tree
.
├── enable-jmx.xml
├── lnramirez-servlet.xml
├── sitemesh3.xml
├── urlrewrite.xml
├── views
│ ├── about.jsp
│ ├── blog
│ │ └── list.jsp
│ ├── defaultdecorator.jsp
│ └── home.jsp
└── web.xml
my sitemesh3 configuration
$ cat sitemesh3.xml
<?xml version="1.0" encoding="MacRoman"?>
<sitemesh>
<mapping path="/*" decorator="/WEB-INF/views/defaultdecorator.jsp"/>
</sitemesh>
and my web.xml
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>HiddenMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
beware if you're using UrlRewriteFilter filter like myself you might run into the same trouble I had. You have to place ConfigurableSiteMeshFilter before other filters.
It worked for me
Upvotes: 4
Reputation: 649
this works for me:
decorators.xml:
<decorators defaultdir="/WEB-INF/decorators">
<decorator name="login" page="login_master.jsp">
<pattern>/login*</pattern>
</decorator>
<decorator name="none" page="none.jsp">
<pattern>/report*</pattern>
</decorator>
<decorator name="master" page="master.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
None.jsp:
<html>
<head>
<title>
<decorator:title />
</title>
<decorator:head />
</head>
<body>
<decorator:body />
</body>
</html>
Upvotes: 0