I've never used Tiles, but one approach would be to put the title in a
properties file:
parcelsTitle=Consignment Note for {0}
Then set up a Tiles attribute to hold the key for the title message. I guess it
would look something like:
<definition name="tiles.customer.title.parcels"
extends="tiles.default.layout">
<put name="titleKey" value="parcelsTitle"/>
<put name="content" value="/pages/customerTitleParcels.jsp"/>
</definition>
Then create a scoped variable to hold the key (not sure if this is right):
<tiles:importAttribute name="titleKey"/>
Finally, use <bean:message> with the key and dynamic customer name:
<jsp:useBean id="customerName" type="java.lang.String"/>
<bean:message name="titleKey" arg0="<%= customerName %>"/>
Or:
<bean-el:message name="titleKey" arg0="${customerName}"/>
Quoting Kirk Wylie <[EMAIL PROTECTED]>:
> Have you thought about putting the customer name into request scope in
> your actions and using some type of expression (perhaps using struts-el
> or JSTL) to write out the title? So, for example, you'd have something
> roughly (forgive the fact that I'm not doing it in el):
>
> <% pageTitle = "%><bean.write name="titleFromTiles"><%, " + customerName;
> %>
> <title><%=pageTitle%></title>
>
> So rather than putting the actual final title into the page, you'd put
> in a pattern, and rely on the individual tiles to actually compose the
> page title out of the tiles attribute.
>
> Does that make any sense?
>
> Kirk Wylie
> M7 Corporation
>
> PhilNoon wrote:
> > I am using tiles. I define the title of a web page in tiles-defs.xml as
> in
> > this snippet:
> >
> > <definition name="tiles.customer.title.parcels"
> > extends="tiles.default.layout">
> > <put name="title" value="Customer Consignment Note"/>
> > <put name="content" value="/pages/customerTitleParcels.jsp"/>
> > </definition>
> >
> > Then in my jsp, I have:
> >
> > <tiles:getAsString name="title"/>
> >
> > Which outputs "Customer Consignment Note" as expected.
> >
> > Now my client wants the title to read "Consignment Note for XXXX" where
> > xxxx
> > is the customer's name.
> >
> > Does anyone have an idea how to do this?
--
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]