You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniele Santanche' <da...@genesy.it> on 2004/03/29 17:13:24 UTC

how can I use the to dynamically display images?

I have to create a page in which I display information of a collection of
objects. Each object has it's own image which I want to render near the
details of the object. For these purpose I'm trying to use the html:img tag,
which seems to be able to render images dynamically, but I don't understand
how it works.
What I need in the resulting HTML page is:

     <img src=<the object image file name> >

How can I do this with the tag <html:img>?

Thanks.
    Daniele






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how can I use the to dynamically display images?

Posted by Mark Lowe <ma...@boxstuff.com>.
<html-el:img page="${obj.path}">

or

<img src="<c:url value="${obj.path}" />">

or

<html:img page="<%= obj.getPath() %>">

depending on what you dig.

alternatively you could have an action that returns an image from a 
request

<html:img page="/image.do" name="obj">

which may render to something like
/myapp/image.do?path=/images/foo.gif&name=fooImage

depending on the properties of you object (this example getName() and 
getPath()). There are other attributes you can use to use fewer 
parameters, see docs.

for this you'd need to have an action that returns null as a forward 
but writes an image to the response. I'd go with the first options.

On 29 Mar 2004, at 17:13, Daniele Santanche' wrote:

> I have to create a page in which I display information of a collection 
> of
> objects. Each object has it's own image which I want to render near the
> details of the object. For these purpose I'm trying to use the 
> html:img tag,
> which seems to be able to render images dynamically, but I don't 
> understand
> how it works.
> What I need in the resulting HTML page is:
>
>      <img src=<the object image file name> >
>
> How can I do this with the tag <html:img>?
>
> Thanks.
>     Daniele
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org