don't dream your life, live your dreams !
Please read : Java spring – quickstart
If you use maven, add this to your pom.xml
<dependencies> (...) <dependency> <groupId>org.sitemesh</groupId> <artifactId>sitemesh</artifactId> <version>${sitemesh.version}</version> </dependency> (...) </dependencies> |
Update WebConfig to add sitemesh filter
public class WebConfig extends AbstractAnnotationConfigDispatcherServletInitializer { (...) @Override protected Filter[] getServletFilters() { CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); return new Filter[] { characterEncodingFilter, new ConfigurableSiteMeshFilter()}; } (...) } |
Now ./src/main/webapp/WEB-INF/sitemesh3.xml :
<sitemesh> <mapping path="/*" decorator="/WEB-INF/decorators/layout.jsp"/> </sitemesh> |
Now ./src/main/webapp/WEB-INF/decorators/layout.jsp :
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<sitemesh:write property='head'/>
</head>
<body>
<div id="content">
<sitemesh:write property='body'>Body goes here.</sitemesh:write>
</div>
</body>
</html> |
Copyright © 2025 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.
admin