I’m currently doing this tutorial, but the tutorial uses Glassfish as the server and I’m using Tomcat 7.0.22 as the server. I’m trying to include a header and a footer as .jspf files I only get this:

When it’s supposed to look like this:

It only renders the page without including the header and the footer, also when I go to the category page (http://localhost:8080/AffableBean/category) it renders the page like this:

When it’s supposed to look like this:

My webxml file looks like this:
<?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>
<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>
If I try to use a differente web-app tag like this one:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org
/TR/xmlschema-1/" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-
app_2_4.xsd" version="2.4">
Only the index page will get rendered correctly but when I want to go to another page like
I get a 404 error
Is it because I’m using Tomcat instead of Glassfish?
Something went wrong with your properties of your netbeans project. Everything looks fine to me. You can find an image here:
Please take the following steps and let me know if it provides a solution:
Alternate solution:
Example header.jsp
Include it where you need it in your webpage (jsp), by using
As you see you don’t need to re-add all the html in the header.jsp, just the part of the header.