What I want to achieve is something similar to a master page in asp.net. I'm following a tutorial, but I may have missed something cause I have added my header.jspf and footer.jspf to the WEB-INF/jspf folder and index.jsp is outside of WEB-INF. I have added info in web.xml so that certain jsp-pages should automatically add the header and footer. The problem might be that index.jsp can't access anything inside the WEB-INF folder, but I thought I had solved that in a previous step in the tutorial. When I run the project, all I get is what's left of index.jsp after I remove all the header and footer stuff.
I don't want to use: <%@include file="header.jspf" %>
and <..jsp:include...>
.
Screenshot:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
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_3_0.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<jsp-config>
<jsp-property-group>
<description>header and footer settings</description>
<url-pattern>/index.jsp</url-pattern>
<url-pattern>/WEB-INF/view/*</url-pattern>
<include-prelude>/WEB-INF/jspf/header.jspf</include-prelude>
<include-coda>/WEB-INF/jspf/footer.jspf</include-coda>
</jsp-property-group>
</jsp-config>
</web-app>
header.jspf:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Webshop</title>
</head>
<body>
<h1>Webshop</h1>
footer.jspf:
</body>
</html>