You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vineith Kaul <vi...@gmail.com> on 2009/12/19 23:17:46 UTC

Struts2 drop down box

Does anyone know how to differentially color options in struts 2 drop  
down.e.g I need one option to be in red other to be in blue etc.I  
tried to look for it - looks like has smthng to do with cssSyle but  
not sure how can we apply it for different options of the drop  
down.FYI : I m populating the drop down using the list attribute from  
the database.


Thanks
Vineith



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


Re: Struts2 drop down box

Posted by vineith kaul <vi...@gmail.com>.
Thanks  a lot  Pawel and Dave for pointing me in the right direction.

For anyone with a similar problem , this is what I did.Although I never
quite understand when to put a ${ attribute } and when to put %{attribute}

<select>
                        <s:iterator value="listValues">
                            <option  value="<s:property value="code"/>"
style="color:${attribute}">
                            <s:property value="description"/>
                            </option>
                        </s:iterator>
  </select>

Thanks!
Vineith

2009/12/21 Paweł Wielgus <po...@gmail.com>

> Hi Vineith,
> the question is more about does HTML select options allow for such thing?
> Honestly i have no idea, also it has nothing to do with struts.
> But if the answear is yes, You can do it yourself, simply generate
> HTML code by hand. Create select html element by writing its HTML code
> and inside it, iterate over all your options and produce HTML option
> code for each but with special style added < option
> style="background-color: black;" />
>
> Best greetings,
> Pawel Wielgus.
>
>
> 2009/12/21, vineith kaul <vi...@gmail.com>:
> > Can someone please help me with this ?
> > Really appreciate any input.This is my first post on this struts2
> > mailing-list :-)
> >
> > Thanks!
> > Vineith
> >
> > On Sat, Dec 19, 2009 at 5:17 PM, Vineith Kaul <vi...@gmail.com> wrote:
> >
> >> Does anyone know how to differentially color options in struts 2 drop
> >> down.e.g I need one option to be in red other to be in blue etc.I tried
> to
> >> look for it - looks like has smthng to do with cssSyle but not sure how
> >> can
> >> we apply it for different options of the drop down.FYI : I m populating
> >> the
> >> drop down using the list attribute from the database.
> >>
> >>
> >> Thanks
> >> Vineith
> >>
> >>
> >>
> >
> >
> > --
> > Vineith Kaul
> > Bioinformatics Application Developer/Analyst
> > Department of Medical Genetics
> > Emory School of Medicine-Atlanta,GA
> > # 213-379-3539
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Vineith Kaul
Bioinformatics Application Developer/Analyst
Department of Medical Genetics
Emory School of Medicine-Atlanta,GA
# 213-379-3539

Re: Struts2 drop down box

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Vineith,
the question is more about does HTML select options allow for such thing?
Honestly i have no idea, also it has nothing to do with struts.
But if the answear is yes, You can do it yourself, simply generate
HTML code by hand. Create select html element by writing its HTML code
and inside it, iterate over all your options and produce HTML option
code for each but with special style added < option
style="background-color: black;" />

Best greetings,
Pawel Wielgus.


2009/12/21, vineith kaul <vi...@gmail.com>:
> Can someone please help me with this ?
> Really appreciate any input.This is my first post on this struts2
> mailing-list :-)
>
> Thanks!
> Vineith
>
> On Sat, Dec 19, 2009 at 5:17 PM, Vineith Kaul <vi...@gmail.com> wrote:
>
>> Does anyone know how to differentially color options in struts 2 drop
>> down.e.g I need one option to be in red other to be in blue etc.I tried to
>> look for it - looks like has smthng to do with cssSyle but not sure how
>> can
>> we apply it for different options of the drop down.FYI : I m populating
>> the
>> drop down using the list attribute from the database.
>>
>>
>> Thanks
>> Vineith
>>
>>
>>
>
>
> --
> Vineith Kaul
> Bioinformatics Application Developer/Analyst
> Department of Medical Genetics
> Emory School of Medicine-Atlanta,GA
> # 213-379-3539
>

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


RE: Struts2 drop down box

Posted by "Kawczynski, David" <da...@merck.com>.
If you're using S2's form taglibs to construct the select list, I don't
think you will find the level of control needed for this.  Not unless
you know how to do that with a single css style element.  If you do,
specify that style class as the <s:select cssClass> attribute.  

If you're not trying to do this, your only hope may be to use
<s:iterate> to loop the List obtained from the DB, and evaluate the
#rowstatus.odd value to print out alternating class attributes on an
<option> tag using the <s:property> tag or ognl.


> -----Original Message-----
> From: vineith kaul [mailto:vineith@gmail.com] 
> Sent: Monday, December 21, 2009 12:32 PM
> To: user@struts.apache.org
> Subject: Re: Struts2 drop down box
> 
> Can someone please help me with this ?
> Really appreciate any input.This is my first post on this struts2
> mailing-list :-)
> 
> Thanks!
> Vineith
> 
> On Sat, Dec 19, 2009 at 5:17 PM, Vineith Kaul 
> <vi...@gmail.com> wrote:
> 
> > Does anyone know how to differentially color options in 
> struts 2 drop
> > down.e.g I need one option to be in red other to be in blue 
> etc.I tried to
> > look for it - looks like has smthng to do with cssSyle but 
> not sure how can
> > we apply it for different options of the drop down.FYI : I 
> m populating the
> > drop down using the list attribute from the database.
> >
> >
> > Thanks
> > Vineith
> >
> >
> >
> 
> 
> -- 
> Vineith Kaul
> Bioinformatics Application Developer/Analyst
> Department of Medical Genetics
> Emory School of Medicine-Atlanta,GA
> # 213-379-3539
> 
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates Direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.


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


Re: Struts2 drop down box

Posted by vineith kaul <vi...@gmail.com>.
Can someone please help me with this ?
Really appreciate any input.This is my first post on this struts2
mailing-list :-)

Thanks!
Vineith

On Sat, Dec 19, 2009 at 5:17 PM, Vineith Kaul <vi...@gmail.com> wrote:

> Does anyone know how to differentially color options in struts 2 drop
> down.e.g I need one option to be in red other to be in blue etc.I tried to
> look for it - looks like has smthng to do with cssSyle but not sure how can
> we apply it for different options of the drop down.FYI : I m populating the
> drop down using the list attribute from the database.
>
>
> Thanks
> Vineith
>
>
>


-- 
Vineith Kaul
Bioinformatics Application Developer/Analyst
Department of Medical Genetics
Emory School of Medicine-Atlanta,GA
# 213-379-3539