tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Nine <todd.n...@gmail.com>
Subject Re: Help with inserting title pages on dynamic template construction
Date Sun, 29 Nov 2009 04:16:21 GMT
Hi again Antonio,
  Sorry it's taken so long to respond, this is a pet project and I seem to
be short on time lately.  I've configured the servlet with the paramerts
specified here

http://tiles.apache.org/2.1/framework/tutorial/advanced/el-support.html

Note that the class name has a typo, the example displays

 <param-value>org.apache.tiles.evaluator.el.ELAttributeEvaluatr</param-value>

But it should be

 <param-value>org.apache.tiles.evaluator.el.ELAttributeEvaluator</param-value>


I have the following config in my spring configuration.  I know the
evaluator is getting set into the servlet, I stepped through the
spring code.


	<!-- Tiles setup -->
	<bean id="tilesConfigurer"
		class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
		<property name="definitions">
			<list>
				<value>/WEB-INF/views/layouts/default.xml</value>
			</list>
		</property>
		<property name="tilesProperties">
		  <props>
		      <prop key="org.apache.tiles.evaluator.AttributeEvaluator">org.apache.tiles.evaluator.el.ELAttributeEvaluator</prop>
		  </props>
		</property>
	</bean>


	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver"
		p:viewClass="com.onwebconsulting.inventory.web.spring.AutoTilesView" />

I then have this in my default.xml

<tiles-definitions>
	<definition name="*/*" template="/WEB-INF/views/layouts/default.jsp">
	    <put-attribute name="title" value="${pageTitle}"/>
		<put-attribute name="header" value="/WEB-INF/views/tiles/header.jsp" />
		<put-attribute name="menu" value="/WEB-INF/views/tiles/menu.jsp" />
		<!--<put-attribute name="body" value="/WEB-INF/views/parts/list.jsp" />-->
		<put-attribute name="footer" value="/WEB-INF/views/tiles/footer.jsp" />
	</definition>
</tiles-definitions>

And this in my "body" page, which is dynamically added via the
AutoTilesView class


<c:set var="submit" value="Update Part"/>
<c:set var="pageTitle" value="Update Part Title"/>
<tiles:put name="pageTitle" type="string" value="Update Part" />

<h2>New Part</h2>
<%@ include file="/WEB-INF/views/parts/form.jsp" %>

However, when my html is rendered, I have the variable ${pageTitle} in
my browser, not "Update Part Title" which i've set in my body content.
 What am I doing wrong?

Thanks again for all your help,
Todd



On Tue, Nov 17, 2009 at 9:38 PM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/11/17 Todd Nine <todd.nine@gmail.com>:
> > Thanks for the help Antonio.  I'm not quite sure how I can get the title.
> > I'ved used the Spring framework to inject my body jsp path based on the
> > Action path.  I'm using REST style urls, so I have a
> > <controller>/<action>(/<other args>)* syntax on all my calls.
 Getting
> the
> > body dynamially injected only took the following.  However, I don't want
> my
> > title's based on interception as that's part of the view.  Its not
> possible
> > to "bubble" attributes from includes up to their parent?
>
> Mmm... Let me understand you.
> You set the title somewhere in the Spring view, right? And you want to
> use it as a Tiles definition.
> Try using EL then:
> http://tiles.apache.org/2.1/framework/tutorial/advanced/el-support.html
>
> Antonio
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message