NutzCN Logo
问答 sitemesh3+nutz
发布于 2669天前 作者 悍匪 1790 次浏览 复制 上一个帖子 下一个帖子
标签:
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>


sitemesh3.xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemesh>
   <mapping path="*" decorator="/WEB-INF/sitemesh/sitemesh.jsp" />
   <mapping path="/login.jsp" exclue="true" />
</sitemesh>	

配置不生效  求解
15 回复

整个web.xml贴一下

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
id="WebApp_ID" version="2.5">
  <display-name>evanshare</display-name>
  <filter>
      <filter-name>evanshare</filter-name>
      <filter-class>com.evanshare.filter.ResourceFilter</filter-class>
      
      <init-param>
          <param-name>modules</param-name>
          <param-value>com.evanshare.MainModule</param-value>
      </init-param>
  </filter>
  <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-mapping>
      <filter-name>evanshare</filter-name>
      <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
  </filter-mapping>
      <filter>
        <filter-name>DruidWebStatFilter</filter-name>
        <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,/rs/*</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>DruidWebStatFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

  <error-page>
        <error-code>500</error-code>
        <location>/WEB-INF/jsp/500.jsp</location>
    </error-page>
    <servlet>
        <servlet-name>DruidStatView</servlet-name>
        <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>DruidStatView</servlet-name>
        <url-pattern>/druid/*</url-pattern>
    </servlet-mapping>

  <!--引入spring-->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:applicationContext.xml</param-value>
        <!-- 默认是/WEB-INF/applicationContext.xml -->
    </context-param>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <servlet>
        <servlet-name>SpringMVC</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:SpringMVC-servlet.xml</param-value>
            <!-- 默认是/WEB-INF/[servlet名字]-servlet.xml -->
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>SpringMVC</servlet-name>
        <url-pattern>/spring/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
  
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="nutzbook" version="3.0">
	<filter>
		<filter-name>Wx_jewel</filter-name>
		<filter-class>com.subang.jewel.shiro.realm.ResourceFilter</filter-class>
		
		<init-param>
          <param-name>modules</param-name>
          <param-value>com.subang.jewel.MainModule</param-value>
      </init-param>
	</filter>

	<filter-mapping>
		<filter-name>Wx_jewel</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>
	
	
	<filter>
		<filter-name>nutz</filter-name>
		<filter-class>org.nutz.mvc.NutFilter</filter-class>
		<init-param>
			<param-name>modules</param-name>
			<param-value>com.subang.jewel.MainModule</param-value>
		</init-param>
	</filter>
		<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-mapping>
		<filter-name>nutz</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>
	  <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
</web-app>
	

贴错了 下边这个是

sitemesh的filter放在最前面

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="nutzbook" version="3.0">
	<filter>
		<filter-name>sitemesh</filter-name>
		<filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
	</filter>
	<filter>
		<filter-name>Wx_jewel</filter-name>
		<filter-class>com.subang.jewel.shiro.realm.ResourceFilter</filter-class>

		<init-param>
			<param-name>modules</param-name>
			<param-value>com.subang.jewel.MainModule</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>Wx_jewel</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>


	<filter>
		<filter-name>nutz</filter-name>
		<filter-class>org.nutz.mvc.NutFilter</filter-class>
		<init-param>
			<param-name>modules</param-name>
			<param-value>com.subang.jewel.MainModule</param-value>
		</init-param>
	</filter>
	
	<filter-mapping>
		<filter-name>sitemesh</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>nutz</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>login.jsp</welcome-file>
	</welcome-file-list>
</web-app>
	

还是不行

找个入口方法打印一下堆栈,贴一下

com.subang.jewel.MainSetup/tMainSetup.java/t35/tinit
-----------------------------------
org.nutz.mvc.impl.NutLoading/tNutLoading.java/t277/tevalSetup
-----------------------------------
org.nutz.mvc.impl.NutLoading/tNutLoading.java/t121/tload
-----------------------------------
org.nutz.mvc.ActionHandler/tActionHandler.java/t19/t<init>
-----------------------------------
org.nutz.mvc.NutFilter/tNutFilter.java/t87/t_init
-----------------------------------
org.nutz.mvc.NutFilter/tNutFilter.java/t65/tinit
-----------------------------------
com.subang.jewel.shiro.realm.ResourceFilter/tResourceFilter.java/t25/tinit
-----------------------------------
org.apache.catalina.core.ApplicationFilterConfig/tApplicationFilterConfig.java/t279/tinitFilter
-----------------------------------
org.apache.catalina.core.ApplicationFilterConfig/tApplicationFilterConfig.java/t260/tgetFilter
-----------------------------------
org.apache.catalina.core.ApplicationFilterConfig/tApplicationFilterConfig.java/t105/t<init>
-----------------------------------
org.apache.catalina.core.StandardContext/tStandardContext.java/t4958/tfilterStart
-----------------------------------
org.apache.catalina.core.StandardContext/tStandardContext.java/t5652/tstartInternal
-----------------------------------
org.apache.catalina.util.LifecycleBase/tLifecycleBase.java/t145/tstart
-----------------------------------
org.apache.catalina.core.StandardContext/tStandardContext.java/t4138/treload
-----------------------------------
org.apache.catalina.startup.HostConfig/tHostConfig.java/t1539/treload
-----------------------------------
org.apache.catalina.startup.HostConfig/tHostConfig.java/t1512/tcheckResources
-----------------------------------
org.apache.catalina.startup.HostConfig/tHostConfig.java/t1748/tcheck
-----------------------------------
org.apache.catalina.startup.HostConfig/tHostConfig.java/t333/tlifecycleEvent
-----------------------------------
org.apache.catalina.util.LifecycleSupport/tLifecycleSupport.java/t117/tfireLifecycleEvent
-----------------------------------
org.apache.catalina.util.LifecycleBase/tLifecycleBase.java/t90/tfireLifecycleEvent
-----------------------------------
org.apache.catalina.core.ContainerBase/tContainerBase.java/t1370/tbackgroundProcess
-----------------------------------
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor/tContainerBase.java/t1542/tprocessChildren
-----------------------------------
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor/tContainerBase.java/t1552/tprocessChildren
-----------------------------------
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor/tContainerBase.java/t1520/trun
-----------------------------------
java.lang.Thread/tnull/t-1/trun
-----------------------------------

入口方法哦...

new Throwable().printStackTrace();
----------------------
com.subang.jewel.module.UserModule/tUserModule.java/t183/tindex
-----------------------------------
sun.reflect.NativeMethodAccessorImpl/tnull/t-2/tinvoke0
-----------------------------------
sun.reflect.NativeMethodAccessorImpl/tnull/t-1/tinvoke
-----------------------------------
sun.reflect.DelegatingMethodAccessorImpl/tnull/t-1/tinvoke
-----------------------------------
java.lang.reflect.Method/tnull/t-1/tinvoke
-----------------------------------
org.nutz.mvc.impl.processor.MethodInvokeProcessor/tMethodInvokeProcessor.java/t25/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.mvc.impl.processor.AdaptorProcessor/tAdaptorProcessor.java/t33/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.mvc.impl.processor.ActionFiltersProcessor/tActionFiltersProcessor.java/t58/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.integration.shiro.NutShiroProcessor/tNutShiroProcessor.java/t126/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.mvc.impl.processor.ModuleProcessor/tModuleProcessor.java/t123/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.mvc.impl.processor.EncodingProcessor/tEncodingProcessor.java/t27/tprocess
-----------------------------------
org.nutz.mvc.impl.processor.AbstractProcessor/tAbstractProcessor.java/t44/tdoNext
-----------------------------------
org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor/tUpdateRequestAttributesProcessor.java/t15/tprocess
-----------------------------------
org.nutz.mvc.impl.NutActionChain/tNutActionChain.java/t44/tdoChain
-----------------------------------
org.nutz.mvc.impl.ActionInvoker/tActionInvoker.java/t67/tinvoke
-----------------------------------
org.nutz.mvc.ActionHandler/tActionHandler.java/t31/thandle
-----------------------------------
org.nutz.mvc.NutFilter/tNutFilter.java/t198/tdoFilter
-----------------------------------
com.subang.jewel.shiro.realm.ResourceFilter/tResourceFilter.java/t43/tdoFilter
-----------------------------------
org.apache.catalina.core.ApplicationFilterChain/tApplicationFilterChain.java/t241/tinternalDoFilter
-----------------------------------
org.apache.catalina.core.ApplicationFilterChain/tApplicationFilterChain.java/t208/tdoFilter
-----------------------------------
org.apache.catalina.core.StandardWrapperValve/tStandardWrapperValve.java/t218/tinvoke
-----------------------------------
org.apache.catalina.core.StandardContextValve/tStandardContextValve.java/t122/tinvoke
-----------------------------------
org.apache.catalina.authenticator.AuthenticatorBase/tAuthenticatorBase.java/t505/tinvoke
-----------------------------------
org.apache.catalina.core.StandardHostValve/tStandardHostValve.java/t169/tinvoke
-----------------------------------
org.apache.catalina.valves.ErrorReportValve/tErrorReportValve.java/t103/tinvoke
-----------------------------------
org.apache.catalina.valves.AccessLogValve/tAccessLogValve.java/t956/tinvoke
-----------------------------------
org.apache.catalina.core.StandardEngineValve/tStandardEngineValve.java/t116/tinvoke
-----------------------------------
org.apache.catalina.connector.CoyoteAdapter/tCoyoteAdapter.java/t442/tservice
-----------------------------------
org.apache.coyote.http11.AbstractHttp11Processor/tAbstractHttp11Processor.java/t1083/tprocess
-----------------------------------
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler/tAbstractProtocol.java/t640/tprocess
-----------------------------------
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor/tJIoEndpoint.java/t316/trun
-----------------------------------
java.util.concurrent.ThreadPoolExecutor/tnull/t-1/trunWorker
-----------------------------------
java.util.concurrent.ThreadPoolExecutor$Worker/tnull/t-1/trun
-----------------------------------
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable/tTaskThread.java/t61/trun
-----------------------------------
java.lang.Thread/tnull/t-1/trun
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="nutzbook" version="3.0">
	<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>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>

	<filter>
		<filter-name>Wx_jewel</filter-name>
		<filter-class>com.subang.jewel.shiro.realm.ResourceFilter</filter-class>
		<init-param>
			<param-name>modules</param-name>
			<param-value>com.subang.jewel.MainModule</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>Wx_jewel</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>


	<filter>
		<filter-name>nutz</filter-name>
		<filter-class>org.nutz.mvc.NutFilter</filter-class>
		<init-param>
			<param-name>modules</param-name>
			<param-value>com.subang.jewel.MainModule</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>nutz</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>login.jsp</welcome-file>
	</welcome-file-list>
</web-app>
	

好了。。。。这是怎么回事 大叔求解。。

还是我最初说的, filter的顺序

我看到您改的顺序了,但是怎么通过堆栈看出来的。。。(懵逼)

堆栈里面没有sitemesh

添加回复
请先登陆
回到顶部