The example provided isn't quite right, because the quotes are incorrect.
This will work:

  <img src='<bean:write name="BEAN" property="property"/>'>

The reason it works is because, as far as JSP is concerned, the HTML <img>
element is just template text, not XML. You are correct that you cannot use
a tag in the attribute value of another tag because of the rules of XML, so
using the Struts tag instead, like this:

  <html:img src='<bean:write name="BEAN" property="property"/>'/>

does not work.

--
Martin Cooper


> -----Original Message-----
> From: Andy Kriger [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 1:03 PM
> To: Struts Users Mailing List
> Subject: RE: dynamic img src attribute
> 
> 
> When I tried something like that, the <bean:write .../> 
> string ended up in
> my HTML img src - it wasn't interpreted (that is what I'd 
> expect to happen
> since XML isn't supposed to have tags w/in tags and JSPs are 
> supposed to
> conform to XML)
> 
> -----Original Message-----
> From: Dave Weis [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 16:04
> To: Struts Users Mailing List
> Subject: RE: dynamic img src attribute
> 
> 
> 
> On Thu, 19 Sep 2002, Andy Kriger wrote:
> > That is neat - but I'm not talking about query parameters. 
> I'm talking
> about
> > the src string itself.
> 
> <img src="<bean:write name="BEAN" property="property"/>">
> 
> should do it.
> 
> dave
> 
> > >I tried asking this few days ago when my understanding of 
> struts was
> > >significantly less than it is now (and I didn't phrase my 
> question very
> > well
> > >at that).
> > >
> > >Here's what I'd like to do...
> > ><img src='<dynamically generated path stored in a bean>' />
> > >with the constraint that I'd like to avoid the <% %> 
> syntax (i want to
> keep
> > >the JSP free of these things completely for the sake of the content
> > >generating folks that don't know Java/JSP code).
> > >
> > >Is there a struts taglib or other taglib that allows you 
> to do something
> > >like...
> > ><img>
> > >   <param name='src' bean='myBean' property='beanProp' 
> scope='beanScope'>
> > ></img>
> --
> Dave Weis             "I believe there are more instances of 
> the abridgment
> [EMAIL PROTECTED]   of the freedom of the people by gradual 
> and silent
>                       encroachments of those in power than by violent
>                       and sudden usurpations."- James Madison
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 


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

Reply via email to