You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aladin Alaily <st...@aladin.ca> on 2005/05/26 00:39:27 UTC

html:img question

Hi Guys,

Maybe I've been working too long... but I can't seem to figure out the 
following.

I am trying to create an <html:img> tag and dynamically set the alt 
attribute with the application properties file... but it doesn't seem to 
work.

Here is what I'm doing:

<html:img page="/images/logo.gif" alt='<bean:write key="alt.logo" />' />

and in my application.properties file I have:

alt.logo=This is alt text


Now, I would expect that the tag generated by <html:img> as defined 
above would be:
<img src=".." alt="This is alt text">

But I don't !?!

Has anyone encountered this problem before... and how did you resolve it?

Thanks.
Aladin




meyawn wrote:

> well, when you uncheck a checkbox, there is nothing passed to your form. so
> your form doesnt know which checkboxes are there on your page that are
> unchecked. it knows only about the boxes you checked. so i guess you have to
> reset your form after it has inited?? not very sure
> 
> -----Original Message-----
> From: Apte, Dhanashree (Noblestar) [mailto:DApte@jims.hctx.net]
> Sent: Thursday, May 26, 2005 12:21 AM
> To: 'Struts Users Mailing List'
> Subject: html:multibox question
> 
> 
> 
> I have a page that has a series of check-boxes that a user can
> select/deselect at will. When the page loads up, some of the checkboxes are
> already checked. The user can then either select new ones or deselect
> existing ones. However, when I submit the page, the unselected ones are
> still a part of my selectedItems[] array.
> 
> How do I make sure that only the selected ones get through?
> 
> Thanks a bunch,
> <Dhanashree/>
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: html:img question

Posted by Dakota Jack <da...@gmail.com>.
I use buttons for images, imgs, etc. that are internationalized. 
That's all.  My images do contain text.

On 5/26/05, Aladin Alaily <st...@aladin.ca> wrote:
> Dakota Jack wrote:
> > Just out of curiosity, when you don't seem to have internationalized
> > the image, why would you want to do that with the alt?
> 
> The application that I'm building is multilingual.  As such, the "alt"
> property of my images should be converted to the client's locale.
> Having said that, to resolve my problem, I did the following and it
> worked like a charm:
> 
> <html:img ... altKey="alt.logo" />
> 
> The images themselves don't contain any text but the tags should be
> internationalized.  Now it's my turn to ask... What do you mean by
> having an "internationalized image"?... am I missing something here?
> 
> Thanks to everyone for their help.
> 
> Aladin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


Re: html:img question

Posted by Aladin Alaily <st...@aladin.ca>.
Dakota Jack wrote:
> Just out of curiosity, when you don't seem to have internationalized
> the image, why would you want to do that with the alt?

The application that I'm building is multilingual.  As such, the "alt" 
property of my images should be converted to the client's locale. 
Having said that, to resolve my problem, I did the following and it 
worked like a charm:

<html:img ... altKey="alt.logo" />

The images themselves don't contain any text but the tags should be 
internationalized.  Now it's my turn to ask... What do you mean by 
having an "internationalized image"?... am I missing something here?

Thanks to everyone for their help.

Aladin

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


Re: html:img question

Posted by Dakota Jack <da...@gmail.com>.
Just out of curiosity, when you don't seem to have internationalized
the image, why would you want to do that with the alt?

On 5/25/05, Aladin Alaily <st...@aladin.ca> wrote:
> Hi Guys,
> 
> Maybe I've been working too long... but I can't seem to figure out the
> following.
> 
> I am trying to create an <html:img> tag and dynamically set the alt
> attribute with the application properties file... but it doesn't seem to
> work.
> 
> Here is what I'm doing:
> 
> <html:img page="/images/logo.gif" alt='<bean:write key="alt.logo" />' />
> 
> and in my application.properties file I have:
> 
> alt.logo=This is alt text
> 
> 
> Now, I would expect that the tag generated by <html:img> as defined
> above would be:
> <img src=".." alt="This is alt text">
> 
> But I don't !?!
> 
> Has anyone encountered this problem before... and how did you resolve it?
> 
> Thanks.
> Aladin
> 
> 
> 
> 
> meyawn wrote:
> 
> > well, when you uncheck a checkbox, there is nothing passed to your form. so
> > your form doesnt know which checkboxes are there on your page that are
> > unchecked. it knows only about the boxes you checked. so i guess you have to
> > reset your form after it has inited?? not very sure
> >
> > -----Original Message-----
> > From: Apte, Dhanashree (Noblestar) [mailto:DApte@jims.hctx.net]
> > Sent: Thursday, May 26, 2005 12:21 AM
> > To: 'Struts Users Mailing List'
> > Subject: html:multibox question
> >
> >
> >
> > I have a page that has a series of check-boxes that a user can
> > select/deselect at will. When the page loads up, some of the checkboxes are
> > already checked. The user can then either select new ones or deselect
> > existing ones. However, when I submit the page, the unselected ones are
> > still a part of my selectedItems[] array.
> >
> > How do I make sure that only the selected ones get through?
> >
> > Thanks a bunch,
> > <Dhanashree/>
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


Re: html:img question

Posted by croffman <my...@hotmail.com>.
You can use bean:define to create a dynamic JSP variable and set that to the
alt attribute using JSP Scriptlet as follows:
<bean:define id="altVar" type="java.lang.String"><bean:write key="alt.logo"
/></bean:define>
<html:img page="/images/logo.gif" alt="<%= altVar %>" />

I hope this should solve it.

croff

----- Original Message ----- 
From: "Aladin Alaily" <st...@aladin.ca>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, May 25, 2005 5:39 PM
Subject: html:img question


> Hi Guys,
>
> Maybe I've been working too long... but I can't seem to figure out the
> following.
>
> I am trying to create an <html:img> tag and dynamically set the alt
> attribute with the application properties file... but it doesn't seem to
> work.
>
> Here is what I'm doing:
>
> <html:img page="/images/logo.gif" alt='<bean:write key="alt.logo" />' />
>
> and in my application.properties file I have:
>
> alt.logo=This is alt text
>
>
> Now, I would expect that the tag generated by <html:img> as defined
> above would be:
> <img src=".." alt="This is alt text">
>
> But I don't !?!
>
> Has anyone encountered this problem before... and how did you resolve it?
>
> Thanks.
> Aladin
>
>
>
>
> meyawn wrote:
>
> > well, when you uncheck a checkbox, there is nothing passed to your form.
so
> > your form doesnt know which checkboxes are there on your page that are
> > unchecked. it knows only about the boxes you checked. so i guess you
have to
> > reset your form after it has inited?? not very sure
> >
> > -----Original Message-----
> > From: Apte, Dhanashree (Noblestar) [mailto:DApte@jims.hctx.net]
> > Sent: Thursday, May 26, 2005 12:21 AM
> > To: 'Struts Users Mailing List'
> > Subject: html:multibox question
> >
> >
> >
> > I have a page that has a series of check-boxes that a user can
> > select/deselect at will. When the page loads up, some of the checkboxes
are
> > already checked. The user can then either select new ones or deselect
> > existing ones. However, when I submit the page, the unselected ones are
> > still a part of my selectedItems[] array.
> >
> > How do I make sure that only the selected ones get through?
> >
> > Thanks a bunch,
> > <Dhanashree/>
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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


RE: html:img question

Posted by meyawn <na...@gmail.com>.
what is the name of the bean? also try doing something like this:
<script>
var ALT_MESSAGE = "<bean:write key='alt.logo' />" ;
</script>
<html:img page="/images/logo.gif" alt=ALT_MESSAGE />

-----Original Message-----
From: Aladin Alaily [mailto:struts@aladin.ca]
Sent: Thursday, May 26, 2005 1:39 AM
To: Struts Users Mailing List
Subject: html:img question


Hi Guys,

Maybe I've been working too long... but I can't seem to figure out the
following.

I am trying to create an <html:img> tag and dynamically set the alt
attribute with the application properties file... but it doesn't seem to
work.

Here is what I'm doing:

<html:img page="/images/logo.gif" alt='<bean:write key="alt.logo" />' />

and in my application.properties file I have:

alt.logo=This is alt text


Now, I would expect that the tag generated by <html:img> as defined
above would be:
<img src=".." alt="This is alt text">

But I don't !?!

Has anyone encountered this problem before... and how did you resolve it?

Thanks.
Aladin




meyawn wrote:

> well, when you uncheck a checkbox, there is nothing passed to your form.
so
> your form doesnt know which checkboxes are there on your page that are
> unchecked. it knows only about the boxes you checked. so i guess you have
to
> reset your form after it has inited?? not very sure
>
> -----Original Message-----
> From: Apte, Dhanashree (Noblestar) [mailto:DApte@jims.hctx.net]
> Sent: Thursday, May 26, 2005 12:21 AM
> To: 'Struts Users Mailing List'
> Subject: html:multibox question
>
>
>
> I have a page that has a series of check-boxes that a user can
> select/deselect at will. When the page loads up, some of the checkboxes
are
> already checked. The user can then either select new ones or deselect
> existing ones. However, when I submit the page, the unselected ones are
> still a part of my selectedItems[] array.
>
> How do I make sure that only the selected ones get through?
>
> Thanks a bunch,
> <Dhanashree/>
>
>
>
> ---------------------------------------------------------------------
> 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


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