From 1666540cfc4692078648486d6d0d1d6c4cd03e7d Mon Sep 17 00:00:00 2001
From: Roland Haeder <roland@mxchange.org>
Date: Wed, 2 Sep 2015 18:54:30 +0200
Subject: [PATCH] =?utf8?q?Towards=20JSF=20without=20JSP=20includes=20...?=
 =?utf8?q?=20;-)=20Signed-off-by:Roland=20H=C3=A4der=20<roland@mxchange.or?=
 =?utf8?q?g>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 web/imprint.xhtml                   | 66 ++++++++++++-----------------
 web/privacy.xhtml                   | 66 ++++++++++++-----------------
 web/static/guest/guest_footer.jsp   | 19 ---------
 web/static/guest/guest_menu.jsp     | 22 ----------
 web/templates.dist/guest_page.xhtml |  6 ---
 web/terms.xhtml                     | 66 ++++++++++++-----------------
 6 files changed, 81 insertions(+), 164 deletions(-)
 delete mode 100644 web/static/guest/guest_footer.jsp
 delete mode 100644 web/static/guest/guest_menu.jsp

diff --git a/web/imprint.xhtml b/web/imprint.xhtml
index 5c066f68..be755270 100644
--- a/web/imprint.xhtml
+++ b/web/imprint.xhtml
@@ -1,41 +1,29 @@
-<%-- 
-	Document   : login
-	Created on : 11.08.2015, 11:35:53
-	Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
+<?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<link rel="stylesheet" href="${basePath}/style.css" type="text/css" />
-		<title>Pizza-Service - Impressum</title>
-	</head>
-
-	<body>
-		<div id="header"> 
-			<div id="title">
-				<h1>Pizza-Service - Impressum</h1>
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
-		<div id="content_outer">
-			<div id="content_title">
-				<h2>Impressum:</h2>
-			</div>
-
-			<div id="content">
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_footer.jsp" flush="false" />
-	</body>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:ui="http://java.sun.com/jsf/facelets"
+	  xmlns:h="http://xmlns.jcp.org/jsf/html"
+	  xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
+	  xmlns:f="http://xmlns.jcp.org/jsf/core"
+	  >
+
+	<ui:composition template="/WEB-INF/templates/base.tpl">
+		<ui:define name="title">Impressum</ui:define>
+
+		<ui:define name="menu">
+			<ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+		</ui:define>
+
+		<ui:define name="content_header">
+			Impressum
+		</ui:define>
+
+		<ui:define name="content">
+			Hier kommt das Impressum hin!
+		</ui:define>
+
+		<ui:define name="footer">
+			<ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+		</ui:define>
+	</ui:composition>
 </html>
diff --git a/web/privacy.xhtml b/web/privacy.xhtml
index e385c090..0dc63b18 100644
--- a/web/privacy.xhtml
+++ b/web/privacy.xhtml
@@ -1,41 +1,29 @@
-<%-- 
-	Document   : privacy
-	Created on : 11.08.2015, 11:56:22
-	Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
+<?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<link rel="stylesheet" href="${basePath}/style.css" type="text/css" />
-		<title>Pizza-Service - Datenschutzbestimmungen</title>
-	</head>
-
-	<body>
-		<div id="header"> 
-			<div id="title">
-				<h1>Pizza-Service - Datenschutzbestimmungen</h1>
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
-		<div id="content_outer">
-			<div id="content_title">
-				<h2>Datenschutzbestimmungen:</h2>
-			</div>
-
-			<div id="content">
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_footer.jsp" flush="false" />
-	</body>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:ui="http://java.sun.com/jsf/facelets"
+	  xmlns:h="http://xmlns.jcp.org/jsf/html"
+	  xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
+	  xmlns:f="http://xmlns.jcp.org/jsf/core"
+	  >
+
+	<ui:composition template="/WEB-INF/templates/base.tpl">
+		<ui:define name="title">Datenschutzbestimmungen</ui:define>
+
+		<ui:define name="menu">
+			<ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+		</ui:define>
+
+		<ui:define name="content_header">
+			Datenschutzbestimmungen
+		</ui:define>
+
+		<ui:define name="content">
+			Hier kommen die Datenschutzbestimmungen hin.
+		</ui:define>
+
+		<ui:define name="footer">
+			<ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+		</ui:define>
+	</ui:composition>
 </html>
diff --git a/web/static/guest/guest_footer.jsp b/web/static/guest/guest_footer.jsp
deleted file mode 100644
index 4cad7d34..00000000
--- a/web/static/guest/guest_footer.jsp
+++ /dev/null
@@ -1,19 +0,0 @@
-<%-- 
-	Document   : footer
-	Created on : 11.08.2015, 12:28:03
-	Author     : Roland Haeder
---%>
-
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
-<div class="footer">
-	<ul class="footer_nav">
-		<li><a href="${basePath}/">Home</a></li>
-		<li><a href="${basePath}/imprint.jsp">Impressum</a></li>
-		<li><a href="${basePath}/terms.jsp">AGBs</a></li>
-		<li><a href="${basePath}/privacy.jsp">Datenschutz</a></li>
-	</ul>
-</div>
-
-<div class="clear"></div>
diff --git a/web/static/guest/guest_menu.jsp b/web/static/guest/guest_menu.jsp
deleted file mode 100644
index 23551635..00000000
--- a/web/static/guest/guest_menu.jsp
+++ /dev/null
@@ -1,22 +0,0 @@
-<%-- 
-	Document   : guest_menu
-	Created on : 06.08.2015, 12:41:44
-	Author     : Roland Haeder
---%>
-
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
-<div id="menu">
-	<ul>
-		<li><a href="${basePath}/" title="Eingangsseite">Home</a></li>
-		<li><a href="${basePath}/basket.jsp" title="Zum Warenkorb">Zum Warenkorb</a></li>
-		<li><a href="${basePath}/bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
-	</ul>
-
-	<ul>
-		<li><a href="${basePath}/customer/login.jsp" title="Login für bestehende Kunden">Einloggen</a></li>
-		<li><a href="${basePath}/customer/register.jsp" title="Anmeldung als neuer Kunde">Neuer Kunde</a></li>
-		<li><a href="${basePath}/customer/lost_passwd.jsp" title="Neues Passwort erstellen">Passwort vergessen?</a></li>
-	</ul>
-</div>
diff --git a/web/templates.dist/guest_page.xhtml b/web/templates.dist/guest_page.xhtml
index 7d671852..4577b9ae 100644
--- a/web/templates.dist/guest_page.xhtml
+++ b/web/templates.dist/guest_page.xhtml
@@ -7,12 +7,6 @@
 	  xmlns:f="http://xmlns.jcp.org/jsf/core"
 	  >
 
-	<f:metadata>
-		<f:viewAction action="#{controller.init()}" />
-	</f:metadata>
-
-	<c:set var="basePath" value="#{request.contextPath}" />
-
 	<ui:composition template="/WEB-INF/templates/base.tpl">
 		<ui:define name="title">Your page's title here</ui:define>
 
diff --git a/web/terms.xhtml b/web/terms.xhtml
index 1c365b35..e1de7989 100644
--- a/web/terms.xhtml
+++ b/web/terms.xhtml
@@ -1,41 +1,29 @@
-<%-- 
-	Document   : privacy
-	Created on : 11.08.2015, 11:56:22
-	Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
+<?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<link rel="stylesheet" href="${basePath}/style.css" type="text/css" />
-		<title>Pizza-Service - Allgemeine Geschäftsbedingungen</title>
-	</head>
-
-	<body>
-		<div id="header"> 
-			<div id="title">
-				<h1>Pizza-Service - Allgemeine Geschäftsbedingungen</h1>
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
-		<div id="content_outer">
-			<div id="content_title">
-				<h2>Allgemeine Geschäftsbedingungen:</h2>
-			</div>
-
-			<div id="content">
-			</div>
-		</div>
-
-		<jsp:include page="/static/guest/guest_footer.jsp" flush="false" />
-	</body>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:ui="http://java.sun.com/jsf/facelets"
+	  xmlns:h="http://xmlns.jcp.org/jsf/html"
+	  xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
+	  xmlns:f="http://xmlns.jcp.org/jsf/core"
+	  >
+
+	<ui:composition template="/WEB-INF/templates/base.tpl">
+		<ui:define name="title">Allgemeine Gesch&auml;ftsbedingungen</ui:define>
+
+		<ui:define name="menu">
+			<ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+		</ui:define>
+
+		<ui:define name="content_header">
+			Allgemeine Gesch&auml;ftsbedingungen
+		</ui:define>
+
+		<ui:define name="content">
+			Hier kommen die allgemeinen Gesch&auml;ftsbedingungen hin.
+		</ui:define>
+
+		<ui:define name="footer">
+			<ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+		</ui:define>
+	</ui:composition>
 </html>
-- 
2.39.5