タイル2をJSPで動作させようとしています。nullポインタ例外が発生します。セットアップの方法を説明する適切なドキュメントを見つけるのに苦労しています。私は非常に簡単なユースケースを持っています。「content」という属性を持つテンプレートがあります。次に、「content」属性にjspを挿入して、テンプレートを使用しようとしています。web.xmlファイルに何かを設定する必要があるかどうかわかりませんか?テンプレートと、テンプレートを使用しようとしているjspを貼り付けました。
テンプレートは次のとおりです。
<%@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>
テンプレートを使用しようとしているページは次のとおりです。
<%@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>
Mavenを使用してアプリケーションをビルドしていますが、次の依存関係が指定されています。
<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>
すべてが正常に構築されますが、アプリケーションを実行すると、次のようになります。
javax.servlet.ServletException: com.sun.jersey.api.container.ContainerException: org.apache.jasper.JasperException: java.lang.NullPointerException
誰かがこれを機能させる方法について何かアイデアがありますか?
ありがとう!