struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brice Ruth <br...@fiskars.com>
Subject Re: [Tiles] Populating Tiles definition attribute at runtime
Date Mon, 29 Dec 2003 19:17:14 GMT
The cleanest thing to do here, likely, would be to have your 'content' 
attribute have a value that maps to an Action (/search.do would work, I 
think - Vic might be able to confirm this) and in the Action class, 
define an attribute "heading" stored in request context, that pulls from 
request parameters. The tiles-defs.xml isn't really a "dynamic" 
mechanism in any way - its a config file that is loaded - it isn't 
treated as a JSP that gets compiled into a .java and then compiled to a 
.class servlet.

Alternately, just set your heading attribute in tiles-defs.xml to be 
"Search" or whatever you want, and in the /search.jsp file, use JSTL to 
prepend param.myValue. This would be pretty clean for simple scenarios.

Robert Taylor wrote:

>Greetings, I have a tiles definition in my tiles-defs.xml similar to below:
>
> <definition name="search" extends="layout">
>    <put name="heading" value="{0}Search" type="string" />
>    <put name="content" value="/search.jsp" type="page" />
>  </definition>
>
>which I would like to be able to modify the "heading" value such that
>at runtime I could substitute a value for {0}. 
>
>For example, it would be ideal to use a JSTL type of syntax such as:
>
><definition name="search" extends="layout">
>    <put name="heading" value="${param.myValue}Search" type="string" />
>    <put name="content" value="/search.jsp" type="page" />
>  </definition>
>
>but this does not work.
>
>
>
>robert
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message