На JSP страницах "allStudents" и "Login" шаблон работает. А вот на странице "allStudentsAdmin" он не работает.
MySiteMeshFilter.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
import org.sitemesh.builder.SiteMeshFilterBuilder;
import org.sitemesh.config.ConfigurableSiteMeshFilter;
public class MySiteMeshFilter extends ConfigurableSiteMeshFilter {
@Override
protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
builder.addDecoratorPath("/*", "/WEB-INF/decorators/homeDecorator.jsp")
.addDecoratorPath("/allStudents", "/WEB-INF/decorators/homeDecorator.jsp")
.addDecoratorPath("/login", "/WEB-INF/decorators/loginDecorator.jsp")
.addDecoratorPath("/allStudentsAdmin", "/WEB-INF/decorators/allStudentsAdminDecorator.jsp");
}
}
AllStudentsAdminDecorator
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styleadmin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<!DOCTYPE html>
<div id="header-wrapper">
<div id="header">
<div id="menu">
<ul>
<li class="current_page_item"><a href="${pageContext.request.contextPath}/">Главная страница</a></li>
<sec:authorize access="hasRole('ADMIN') || hasRole('USER')">
<li><a href="${pageContext.request.contextPath}/addStudent">Добавить студента</a></li>
</sec:authorize>
<sec:authorize access="!isAuthenticated()">
<li><a href="${pageContext.request.contextPath}/login"></a>Войти</li>
</sec:authorize>
<sec:authorize access="isAuthenticated()">
<li><a href="${pageContext.request.contextPath}/logout" class="last">Выйти</a></li>
</sec:authorize>
</ul>
</div>
<!-- end #menu -->
<div id="search">
<form method="get" action="">
<fieldset>
<input type="text" name="s" id="search-text" size="15" />
<input type="submit" id="search-submit" value="GO" />
</fieldset>
</form>
</div>
<!-- end #search -->
</div>
</div>
<!-- end #header -->
<!-- end #header-wrapper -->
<div id="logo">
<h1><a href="#">Predilection </a></h1>
<p><em> template design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></em></p>
</div>
<sitemesh:write property='body'/>
<jsp:include page="/WEB-INF/template/allStudentsAdmintemplate.jsp"/>
</body>
</html>
AllStudentsAdmin
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<title>Home</title>
</head>
<body>
<div class="add">
<br>
<br>
<br>
<br>
<center>
<h1>${headerMessage}</h1>
<form:form method="POST" action="${pageContext.request.contextPath}/admin/addStudentAdmin" enctype="multipart/form-data">
<table>
<tr>
<td><label path="Name">Name</label></td>
<td><input type="text" name="name"/></td>
</tr>
<tr>
<td><label path="Surname">Surname</label></td>
<td><input type="text" name="surname"/></td>
</tr>
<tr>
<td><label path="Avatar">Avatar:</label></td>
<td>
<input type="file" name="avatar"/>
</td>
</tr>
<tr>
<td><input class="btn btn-primary" type="submit" value="Добавить"></td>
</tr>
</table>
</form:form>
</center>
</div>
</body>
</html>