You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Billy Ng <ev...@hotmail.com> on 2002/09/14 20:57:49 UTC

How to put value from to tag

If want to pass the value from the bean tag

<bean:message key="imageAlt" />

 to a html:img tag, would anybody tell me how to do it?

<html:img page='....." alt="<put here>" />

Thanks!

Billy Ng

Re: How to put value from to tag

Posted by Billy Ng <ev...@hotmail.com>.
Thanks!

Billy Ng

----- Original Message -----
From: "Eddie Bush" <ek...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, September 14, 2002 3:56 PM
Subject: Re: How to put value from <bean:message> to <html:img> tag


> I think you'd have to use a run-time expression:
>
> <%= myVar %>
>
> I hate using them though.  Hopefully someone else will have a better
> alternative for you.  Oh - just hit me that the JSTL has a param tag too
> --- and you could use the EL to specify your value, rather than having
> (something much too close to) a scriplet (for my taste) in your page.  I
> haven't used it, but my "best guess" is that it would be a drop-in
> replacement for the <jsp:param> tag.
>
> Regards,
>
> Eddie
>
> Billy Ng wrote:
>
> >Sorry, I overlooked it.  That is what I'm looking for, thanks!  Can I ask
> >you one more question, what about if I want to pass the value from the
> >properties file to the jsp:param tag?
> >
> ><jsp:param name="alt" value="..." />
> >
> >Thanks!
> >
> >Billy Ng
> >
>
>
>
> --
> 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: How to put value from to tag

Posted by Eddie Bush <ek...@swbell.net>.
I think you'd have to use a run-time expression:

<%= myVar %>

I hate using them though.  Hopefully someone else will have a better 
alternative for you.  Oh - just hit me that the JSTL has a param tag too 
--- and you could use the EL to specify your value, rather than having 
(something much too close to) a scriplet (for my taste) in your page.  I 
haven't used it, but my "best guess" is that it would be a drop-in 
replacement for the <jsp:param> tag.

Regards,

Eddie

Billy Ng wrote:

>Sorry, I overlooked it.  That is what I'm looking for, thanks!  Can I ask
>you one more question, what about if I want to pass the value from the
>properties file to the jsp:param tag?
>
><jsp:param name="alt" value="..." />
>
>Thanks!
>
>Billy Ng
>



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


Re: How to put value from to tag

Posted by Billy Ng <ev...@hotmail.com>.
Sorry, I overlooked it.  That is what I'm looking for, thanks!  Can I ask
you one more question, what about if I want to pass the value from the
properties file to the jsp:param tag?

<jsp:param name="alt" value="..." />

Thanks!

Billy Ng

----- Original Message -----
From: "Eddie Bush" <ek...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, September 14, 2002 12:14 PM
Subject: Re: How to put value from <bean:message> to <html:img> tag


> altKey="..." ?  Is that what you're searching for?
>
> Billy Ng wrote:
>
> >If want to pass the value from the bean tag
> >
> ><bean:message key="imageAlt" />
> >
> > to a html:img tag, would anybody tell me how to do it?
> >
> ><html:img page='....." alt="<put here>" />
> >
> >Thanks!
> >
> >Billy Ng
> >
>
>
>
> --
> 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: How to put value from to tag

Posted by Eddie Bush <ek...@swbell.net>.
altKey="..." ?  Is that what you're searching for?

Billy Ng wrote:

>If want to pass the value from the bean tag
>
><bean:message key="imageAlt" />
>
> to a html:img tag, would anybody tell me how to do it?
>
><html:img page='....." alt="<put here>" />
>
>Thanks!
>
>Billy Ng
>



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


Re: How to put value from to tag

Posted by Patrick Refondini <pa...@jpnet.ch>.
Billy Ng wrote:
> If want to pass the value from the bean tag
> 
> <bean:message key="imageAlt" />
> 
>  to a html:img tag, would anybody tell me how to do it?
> 
> <html:img page='....." alt="<put here>" />
> 
> Thanks!
> 
> Billy Ng
> 

I have faced a similar issue accessing message from Runtime expressions 
to build javascripts without the html:img altKey attribute solution.
Thanks to the Struts users mailing list I ended using the following code:

<bean:define id="aBtn">
   <bean:message key="abtn.image"/>
</bean:define>

<bean:define id="aBtnActive">
   <bean:message key="abtn.active.image"/>
</bean:define>

and then using it with a runtime expression like :

<nested:image
   srcKey="abtn.image"
   property   ="setCloseAction"
   onmouseover='<%="this.src=\'" + aBtnActive + "\'"%>'
   onmouseout ='<%="this.src=\'" + aBtn + "\'"%>' />

I do not know if there is a better alternative ?

Patrick



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