siteMesh + Spring 3.0 +排除模式 [英] siteMesh + Spring 3.0 + Exclude pattern
问题描述
除了欢迎页面,我希望所有请求都得到修饰.这是当只有我的应用程序上下文位于url中而没有其他路径元素时显示的默认页面.
I would like to have all the requests decorated except my welcome page. This is the default page I display when only my application context is in the url with no other path elements.
http://主机名:8080/MyApp/->不应对此进行修饰.这应该显示我的欢迎页面.如何排除呢?
http://hostname:8080/MyApp/ -> This should not be decorated. This should show my Welcome page. How do I exclude this?
http://hostname:8080/MyApp/user -> This gets decorated now with below config
我有以下decorators.xml.
I have the following decorators.xml.
<!-- Any urls that are excluded will never be decorated by Sitemesh -->
<excludes>
<pattern>/exclude/*</pattern>
</excludes>
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
我正在使用Spring MVC,其中将调度servlet配置为接收所有输入请求.而且我有一个控制器来显示我的欢迎"页面,用于请求映射"/".
I am using Spring MVC where the dispatch servlet is configured to take all the input requests. and I have a controller to display my Welcome page for request mapping "/".
<servlet-mapping>
<servlet-name>MyApp</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
推荐答案
我找到了一种自己做的方法.在我的welcome.jsp中,添加了如下所示的元标记,在decorators.xml中,您添加了一个欢迎使用的装饰器.
I found a way to do it myself. In my welcome.jsp I added a meta tag as shown below and in the decorators.xml you add a decorator for welcome.
<head>
<meta name="decorator" content="welcome">
</head>
decorators.xml
decorators.xml
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
<decorator name="welcome" page="welcome.jsp"/>
这篇关于siteMesh + Spring 3.0 +排除模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!