I'm trying to get tiles 2 working with JSP. I'm getting a null pointer exception. I'm having trouble finding good documentation that explains how to get setup. I have a pretty easy use case. I have a template with an attribute called "content". I'm then trying to use the template by inserting a jsp into the "content" attribute. I'm not sure if I need to set anything up in my web.xml file? I've pasted my template and the jsp that is trying to use the template.
Here is the template:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="template" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-ui-1.8.5.custom.css" type="text/css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/app.css" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>
<title>Cheetah Home</title>
</head>
<body>
<div id="wrapper">
<jsp:include page="${pageContext.request.contextPath}/jsp/layout/top.jsp"></jsp:include>
<template:insertAttribute name="content"></template:insertAttribute>
</div>
</body>
</html>
Here is a page trying to use the template:
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="template" %>
<template:insertTemplate template="/templates/homeTemplate.jsp">
<template:putAttribute name="content" value="test.jsp">
</template:putAttribute>
</template:insertTemplate>
I'm using Maven to build the application, and I have the following dependencies specified:
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
</dependency>
Everything builds fine, but when I run the application I get:
javax.servlet.ServletException: com.sun.jersey.api.container.ContainerException: org.apache.jasper.JasperException: java.lang.NullPointerException
Anyone have any ideas on how to get this working?
Thanks!