SiteMesh学习入门

SiteMesh学习入门
http://www.java3z.com/cwbwebhome/article/article2/2962.html

struts2中使用sitemesh
http://hsys.iteye.com/blog/857704
http://www.renren.it/a/JAVAbiancheng/Struts/20101120/48699.html
这里是Sitemesh跟struts2的整合配置,顺序不能反过来,否则无法解析struts2的标签等问题。
web.xml
--------------------
<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>  
    </filter-mapping>
    
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>



decorators.xml
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators">
       <!-- used whit main.jsp -->
       <decorator name="main" page="main.jsp">
           <pattern>/*</pattern>
       </decorator>
</decorators>

<pattern>/*</pattern>这里要小心,strtus.xml的package里面的namespace,和默认的空间是否相应。否则问题出现了,很难找到。一般就直接要"/*", 尽量不要加用"/pages/*"之类的。
一个需要注意的地方:
http://hi.baidu.com/tao_young/blog/item/bd457a557d91b554d0090637.html

	   <excludes>
	   		<pattern>/error.jsp</pattern>
	   </excludes>

当这个排除失效的时候,请改成:
<decorator name="none">
			<pattern>/excludes/*</pattern>
			<pattern>/error.jsp</pattern>
	   </decorator>




Struts2与SiteMesh的结合
http://www.sunxin.org/forum/thread/20088.html

你可能感兴趣的:(apache,thread,html,xml,struts)