You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Robert D. Morse" <rm...@mdesignz.com> on 2002/02/15 22:35:55 UTC
Using Tiles tags as values for Struts and HTML
I have a Tiles definition that looks something like this:
<tiles-definition>
<definition name="test.definition" path=/templates/test.jsp">
...a series of <put>'s....
<put name="background" value="/images/test.gif"/>
</definition>
</tiles-definition>
Now, I want to use the value of "background" as the value for something like
the background=" " in the HTML Body tag. In other words:
<BODY background=<tiles:getAsString name="background"/> >
This doesn't work.
I've tried enclosing in quotes, escaped quote, apostrophe, and I can't seem
to make it work. Any suggestions?
If you haven't tried Tiles with Struts, you're really missing out.
-------------------------------------------
Robert D. Morse
rmorse@mdesignz.com
PGP Key: D9C4AA6A
PGP Finger Print: ED56 DEEA 95CF AC99 C2B0 77D4 7D92 ACCA D9C4 AA6A
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Using Tiles tags as values for Struts and HTML
Posted by Cedric Dumoulin <ce...@lifl.fr>.
See intermixed.
"Robert D. Morse" wrote:
> It the example below, "background" is available *only* in the test.jsp file.
> If I try to use <tiles:useAttribute> in any other jsp file in that
> particular tiles-definition, I get an exception saying that "background"
> isn't in any context.
True, attributes of a Tile are only visible inside this Tile, not in sub-Tiles or
parent.
> Setting various context in the definition had no
> effect.
There is no attribute to set such context in definition tag :-) You can let xml
parser check your definitions file syntax by enabling tiles validation in
web.xml.
> I got around this by using the <tiles:useAttribute> in the test.jsp
> file and then setting a session attribute that was then visible by the rest
> of the files.
>
> -----Original Message-----
> From: Cedric Dumoulin [mailto:cedric.dumoulin@lifl.fr]
> Sent: Monday, February 18, 2002 7:48 AM
> To: Struts Users Mailing List
> Subject: Re: Using Tiles tags as values for Struts and HTML
>
> Hi,
>
> For me, it should work. Is there any exception ? What is the resulting
> html
> source code ?
>
> Also, you can try following in your "/templates/test.jsp" if you have some
> trouble with quotes :
> <tiles:useAttribute name="background" />
> <BODY background="<%=background%>" >
>
> Cedric
>
> "Robert D. Morse" wrote:
>
> > I have a Tiles definition that looks something like this:
> >
> > <tiles-definition>
> > <definition name="test.definition" path=/templates/test.jsp">
> > ...a series of <put>'s....
> > <put name="background" value="/images/test.gif"/>
> > </definition>
> > </tiles-definition>
> >
> > Now, I want to use the value of "background" as the value for something
> like
> > the background=" " in the HTML Body tag. In other words:
> >
> > <BODY background=<tiles:getAsString name="background"/> >
> >
> > This doesn't work.
> > I've tried enclosing in quotes, escaped quote, apostrophe, and I can't
> seem
> > to make it work. Any suggestions?
> >
> > If you haven't tried Tiles with Struts, you're really missing out.
> >
> > -------------------------------------------
> > Robert D. Morse
> > rmorse@mdesignz.com
> > PGP Key: D9C4AA6A
> > PGP Finger Print: ED56 DEEA 95CF AC99 C2B0 77D4 7D92 ACCA D9C4 AA6A
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Using Tiles tags as values for Struts and HTML
Posted by "Robert D. Morse" <rm...@mdesignz.com>.
It the example below, "background" is available *only* in the test.jsp file.
If I try to use <tiles:useAttribute> in any other jsp file in that
particular tiles-definition, I get an exception saying that "background"
isn't in any context. Setting various context in the definition had no
effect. I got around this by using the <tiles:useAttribute> in the test.jsp
file and then setting a session attribute that was then visible by the rest
of the files.
-----Original Message-----
From: Cedric Dumoulin [mailto:cedric.dumoulin@lifl.fr]
Sent: Monday, February 18, 2002 7:48 AM
To: Struts Users Mailing List
Subject: Re: Using Tiles tags as values for Struts and HTML
Hi,
For me, it should work. Is there any exception ? What is the resulting
html
source code ?
Also, you can try following in your "/templates/test.jsp" if you have some
trouble with quotes :
<tiles:useAttribute name="background" />
<BODY background="<%=background%>" >
Cedric
"Robert D. Morse" wrote:
> I have a Tiles definition that looks something like this:
>
> <tiles-definition>
> <definition name="test.definition" path=/templates/test.jsp">
> ...a series of <put>'s....
> <put name="background" value="/images/test.gif"/>
> </definition>
> </tiles-definition>
>
> Now, I want to use the value of "background" as the value for something
like
> the background=" " in the HTML Body tag. In other words:
>
> <BODY background=<tiles:getAsString name="background"/> >
>
> This doesn't work.
> I've tried enclosing in quotes, escaped quote, apostrophe, and I can't
seem
> to make it work. Any suggestions?
>
> If you haven't tried Tiles with Struts, you're really missing out.
>
> -------------------------------------------
> Robert D. Morse
> rmorse@mdesignz.com
> PGP Key: D9C4AA6A
> PGP Finger Print: ED56 DEEA 95CF AC99 C2B0 77D4 7D92 ACCA D9C4 AA6A
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Using Tiles tags as values for Struts and HTML
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Hi,
For me, it should work. Is there any exception ? What is the resulting html
source code ?
Also, you can try following in your "/templates/test.jsp" if you have some
trouble with quotes :
<tiles:useAttribute name="background" />
<BODY background="<%=background%>" >
Cedric
"Robert D. Morse" wrote:
> I have a Tiles definition that looks something like this:
>
> <tiles-definition>
> <definition name="test.definition" path=/templates/test.jsp">
> ...a series of <put>'s....
> <put name="background" value="/images/test.gif"/>
> </definition>
> </tiles-definition>
>
> Now, I want to use the value of "background" as the value for something like
> the background=" " in the HTML Body tag. In other words:
>
> <BODY background=<tiles:getAsString name="background"/> >
>
> This doesn't work.
> I've tried enclosing in quotes, escaped quote, apostrophe, and I can't seem
> to make it work. Any suggestions?
>
> If you haven't tried Tiles with Struts, you're really missing out.
>
> -------------------------------------------
> Robert D. Morse
> rmorse@mdesignz.com
> PGP Key: D9C4AA6A
> PGP Finger Print: ED56 DEEA 95CF AC99 C2B0 77D4 7D92 ACCA D9C4 AA6A
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>