MyException - 我的异常网
当前位置:我的异常网» VC/MFC » SpringMVC3.1 + sitemesh2.4.1调整

SpringMVC3.1 + sitemesh2.4.1调整

www.MyException.Cn  网友分享于:2013-02-20  浏览:472次
SpringMVC3.1 + sitemesh2.4.1整合
详细参考:http://www.ishang123.com/jishubowen/java/2012-09-29/257.html

web.xml
<?xml version="1.0" encoding="UTF-8"?>  
<web-app version="2.5"    
    xmlns="http://java.sun.com/xml/ns/javaee"    
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee    
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
  <servlet>  
        <servlet-name>user</servlet-name>  
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
        <load-on-startup>1</load-on-startup>  
    </servlet>  
    <servlet-mapping>  
        <servlet-name>user</servlet-name>  
        <url-pattern>/</url-pattern>  
    </servlet-mapping>  
  
    <filter>  
        <filter-name>sitemesh</filter-name>  
        <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>  
    </filter>  
    <filter-mapping>  
        <filter-name>sitemesh</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>  
  
    <filter>  
        <filter-name>SpringCharacterEncodingFilter</filter-name>  
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
        <init-param>  
            <param-name>encoding</param-name>  
            <param-value>UTF-8</param-value>  
        </init-param>  
    </filter>  
    <filter-mapping>  
        <filter-name>SpringCharacterEncodingFilter</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>  
</web-app>




decorators.xml
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators/">
	<excludes>
		<pattern>/login.jsp</pattern>
		<pattern>/login.js</pattern>
	</excludes>

	<decorator name="main" page="basic.jsp">
		<pattern>/*</pattern>
		<pattern>/*.jsp</pattern>
	</decorator>
</decorators>



WebRoot/decorators/basic.jsp
<%@ page language="java" pageEncoding="UTF-8"%>  
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator"%>  
<h1>User Manager</h1>  
<hr/>  
<decorator:body/>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有