> -----Original Message-----
> From: David M. Karr [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 8:47 PM
> To: [EMAIL PROTECTED]
> Subject: Tiles: pass "title" value to header page
>
>
> I have a simple page definition that looks like this:
>
> --------------
> <tiles:insert page="basicLayout.jsp">
>  <tiles:put name="title" value="Music Index Home"/>
>  <tiles:put name="header" value="header.jsp"/>
>  <tiles:put name="footer" value="footer.jsp"/>
>  <tiles:put name="sidebar" value="menu.jsp"/>
>  <tiles:put name="body" value="mainBody.jsp"/>
> </tiles:insert>
> --------------
>
> I'm thinking that it might be good to code "header.jsp" so it
> shows the "title"
> string, by reference, instead of hard-coded, so I don't have to
> write it twice,

What would you have twice?  The tiles:put or the tiles:getAsString?
Why not just define the title in the ApplicationResources.properties file?

> in two different places.  I would have to somehow "pass" the
> value provided for
> the "title" attribute to "header.jsp" so it can read it as a
> request attribute,
> possibly.
>
> What are the various ways I could achieve this (hopefully without using
> scriptlets)?  Is this a reasonable thing to do?

It's not clear (to me) what you want to do.
Off-hand (and if I am guess-timating correctly) I can think of about 10
unique ways to avoid duplication of code (or in this case, tiles
configuration)

>
> If I could send "request parameters" or "attributes" with
> "tiles:insert", then
> with my "tiles:insert" tag for the "header" attribute, I could
> pass the output
> of "tiles:getAsString" to get the "title" field.  I don't know if this is
> possible, however.

In concept, you would only want to do this if you wanted a different title
for each view.

I can provide (very basic) code samples for what I consider to be "Best
Practices with Tiles".  Let me know if you would like a copy.

>
> --
> ===================================================================
> David M. Karr          ; Java/J2EE/XML/Unix/C++
> [EMAIL PROTECTED]
>


James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to