You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/06/11 00:10:02 UTC

Parameterizing an in a template

Subject: Parameterizing an <html:img> in a template
From: Eric Rizzo <er...@jibeinc.com>
 ===
Tried searching the list/newsgroup archive for this issue, but only 
found reference to 
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg31204.html 
which mentions "You can't nest a tag inside another tag in jsp" (which I 
already know).  Please forgive and point if this has already been addressed.

I want to define a template JSP that expects as one of its content 
parameters the name of an image to include. What I'd like to do is 
something like:

foo.jsp:

<%@ taglib uri="struts-html.tld" prefix="html" %>
<%@ taglib uri="struts-template.tld" prefix="template" %>

<html:img page="<template:get name='imageFile'/>" />


and then use the template like:

<template:insert template="foo.jsp">
     <template:put name="imageFile"
                   content="foo.jpg"
                   direct="true"/>
</template:insert>

But of course this won't work because you can't use the result of one 
JSP tag as the value for an attribute of another JSP tag. Is there 
another way I can paramterize the image(s) my template uses?

Tiles is not an option for me at this point, but if there is not other 
way how would I set up tiles definitions to accomplish the same thing 
(example would be nice)?

TIA,
	Eric


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Parameterizing an in a template

Posted by Cedric Dumoulin <ce...@lifl.fr>.

  You can use the native html tags instead of the struts one :
<img src="<template:get name='imageFile'/>" />

  Hope this help,
     Cedric


"Struts Newsgroup (@Basebeans.com)" wrote:

> Subject: Parameterizing an <html:img> in a template
> From: Eric Rizzo <er...@jibeinc.com>
>  ===
> Tried searching the list/newsgroup archive for this issue, but only
> found reference to
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg31204.html
> which mentions "You can't nest a tag inside another tag in jsp" (which I
> already know).  Please forgive and point if this has already been addressed.
>
> I want to define a template JSP that expects as one of its content
> parameters the name of an image to include. What I'd like to do is
> something like:
>
> foo.jsp:
>
> <%@ taglib uri="struts-html.tld" prefix="html" %>
> <%@ taglib uri="struts-template.tld" prefix="template" %>
>
> <html:img page="<template:get name='imageFile'/>" />
>
> and then use the template like:
>
> <template:insert template="foo.jsp">
>      <template:put name="imageFile"
>                    content="foo.jpg"
>                    direct="true"/>
> </template:insert>
>
> But of course this won't work because you can't use the result of one
> JSP tag as the value for an attribute of another JSP tag. Is there
> another way I can paramterize the image(s) my template uses?
>
> Tiles is not an option for me at this point, but if there is not other
> way how would I set up tiles definitions to accomplish the same thing
> (example would be nice)?
>
> TIA,
>         Eric
>
> --
> 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>