tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stanlick <stanl...@gmail.com>
Subject Re: Struts 2 and Tiles 2.1.0
Date Mon, 10 Nov 2008 12:44:40 GMT

Thanks Adam -- 

I looked at this option, but would rather use EL in tiles definitions.  It
would be a much cleaner (and intuitive) solution.

Scott



Adam Hardy (debian) wrote:
> 
> stanlick on 09/11/08 00:29, wrote:
>> I would like to use EL in tiles definitions.  Is it supported by Struts
>> 2.x
>> and is there a recipe for this?  I downloaded Tiles 2.1.0 and reviewed
>> the
>> changes, but the web.xml has undergone radical change and I thought I'd
>> do a
>> little fact finding before performing open heart surgery on my working
>> application.
> 
> Hi Scott,
> not directly in tiles.xml, however with just one more step, it's easy.
> This is 
> the approach I took.
> 
> Tiles.xml definition:
> 
>    <definition name="collatedAnalysisInsert.tile"
>      extends="collatedAnalysisList.tile">
>      <put-attribute name="tilesSubmitAction" value="collated-analysis/new"
> />
>      <put-attribute name="bodyContentTile"
>        value="/WEB-INF/jsp/collated-analysis/edit.jsp" />
>      <put-attribute name="tilesContextHeader"
>        value="collatedanalysis.insert.pageHeader" />
>      <put-attribute name="tilesAdditionalTitle" type="string"
>        value="collatedRun.portfolio.title" />
>    </definition>
> 
> Sorry it's a bit of dry example. The last attribute 'tilesAdditionalTitle'
> is 
> actually the reference to a javabean object with nested objects found in
> the 
> requestAttributes, but as far as tiles is concerned, it's just a string
> attribute.
> 
> In the JSP, I can retrieve it from the requestAttributes using the JSTL 
> requestScope[] map. I use it like this:
> 
> <tiles:importAttribute />
> <h1 class="contextHeader">
>    <fmt:message key="${tilesContextHeader}">
>      <c:if test="${!empty tilesAdditionalTitle}">
>        <fmt:param value="${requestScope[tilesAdditionalTitle]}"  />
>      </c:if>
>    </fmt:message>
> </h1>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2-and-Tiles-2.1.0-tp20402071p20419250.html
Sent from the tiles users mailing list archive at Nabble.com.


Mime
View raw message