hi,
you can do this in this way:
<logic:iterate name="promptList" type="my.bean.type" id="element">
<img src="/module/image-directory/<bean:write name="element"
property="gifName"/>" alt="<bean:write name="element" property="name"/>">
<a href="/module/action-path/<bean:write name="element"
property="accession"/>"><bean:write name="element" property="accession"/></a>
</logic:iterate>
kind regards,
frank
> -----Ursprüngliche Nachricht-----
> Von: andy law (RI) [mailto:[EMAIL PROTECTED]
> Gesendet: Freitag, 2. September 2005 10:45
> An: Struts Users Mailing List
> Betreff: img source path constructed inside an iterate tag
>
>
> All,
>
> This looks - at first sight - the place that I should be
> using a html:img tag, but now that I get down to it, I find
> that the html:img tag seems to be useful only for some
> obscure task that is beyond my limited comprehension.
> Obviously, I *am* an idiot, so once we have that out in the
> open please humour me.
>
>
> I have a jsp that lists a set of items, each of which should
> have an icon, and a clickable link. Each item needs to be
> placed inside a row in a table. Thus, I have a bean that
> returns a list that can be iterated across using the
> logic:iterate tag.
>
> In side the iterate loop, I can get at the individual
> elements. Each of them is a bean and I can use bean:tags to
> get them to report their properties. So, for example I have
> code like the following:
>
> <logic:iterate name="promptList" type="my.bean.type" id="element">
> <tr>
> <td><bean:write name="element" property="name"/></td>
> <td><bean:write name="element" property="gifName"/></td>
> <td><bean:write name="element" property="accession"/></td>
> </tr>
> </logic:iterate>
>
> which gives me something that looks like:
>
> name1 gif1.gif abc123
> name2 gif96.gif abc987
>
> etc.
>
>
> What I *want* to generate is something that looks like:
>
> <img src="/module/image-directory/gif1.gif" alt="name1"><a
> href="/module/action-path/abc123">abc123</a>
> <img src="/module/image-directory/gif96.gif" alt="name2"><a
> href="/module/action-path/abc987">abc987</a>
>
>
> i.e. generate the img and link tags dynamically using
> properties of the bean 'element'.
>
> It seems to me from reading the docs and beating my head
> against the screen all day yesterday that the struts :img and
> :link tags don't look at beans in block or page scope inside
> logic:iterate tags, restricting their functionality instead
> to pulling name/value pairs from the request or from a Map
> object. Presumably they then just add those to the tail of
> the request ala /path/to/action?key=value (which is
> occasionally useful in a link, but less so in an img tag IMO).
>
> So, my questions are (for those brave souls who made it this far)
>
> 1) Am I doing this the 'right' way?
> 2) Am I missing something?
> 3) What is the path of least resistance for me to follow?
> 4) How useful would an addition to the struts tag
> functionality to do this sort of thing be? (I will write it
> if I have to)
>
>
> FWIW, I *know* that I can build an img tag and a link
> dynamically using a combination of html and <bean:write> tags
> in the JSP, but I'm going blind working out where to use
> single and double quotes to keep all the tools involved comfortable.
>
>
> Thanks in advance for your suggestions and help.
>
> Later,
>
> Andy
>
> -------------
> Dr. Andy Law
> --------------------
> Head of Bioinformatics - Roslin Institute
>
> Unfortunately, legal niceties require me to add the following
> to this message...
>
> The information contained in this e-mail (including any
> attachments) is confidential and is intended for the use of
> the addressee only. The opinions expressed within this
> e-mail (including any attachments) are the opinions of the
> sender and do not necessarily constitute those of Roslin
> Institute (Edinburgh) ("the Institute") unless specifically
> stated by a sender who is duly authorised to do so on behalf
> of the Institute.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]