Spring 3.2とtiles 3.0を使用しています。
このように、Spring Bean プロパティからタイル定義の属性の値を設定したい
<put-attribute name="headTitle" expression="${msgs['serviceGroups.title']}" />
msgs はHashMapであり、Spring アプリケーションコンテキストで定義されています
<bean id="msgs" class="qa.gov.moi.eservices.web.util.MessageSourceMapAdapter">
<constructor-arg name="messageSource">
<ref bean="messageSource"/>
</constructor-arg>
</bean>
これは春のタイルの設定です
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-defs.xml</value>
</list>
</property>
</bean>
そしてこれはテンプレート default.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><tiles:getAsString name="headTitle"/></title>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="top_header">
<tiles:insertAttribute name="heading" />
<tiles:insertAttribute name="menuTab" />
<tiles:insertAttribute name="genralizationTab" />
</div><!-- top_header -->
<tiles:insertAttribute name="content" />
<tiles:insertAttribute name="footer" />
</div><!-- container -->
</div><!-- wrapper -->
</body>
アプリケーションを実行しようとすると、次の例外が発生しました
Uncaught exception created in one of the service methods of the servlet /WEB-INF/jsp/layouts/default.jsp in application eservices. Exception created : java.lang.NullPointerException
この問題を除いて、すべて問題ありません。
Spring Bean をタイル式にアクセスできるようにする方法はありますか?