• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to change color in the options using html:options  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now my code is like this ,


<html:select property="stdCode" value="" style="width=99%;">

<option value="">-- Choose an Option --</option>

<html:options collection="lspproval" property="code" labelProperty="name"/>

</html:select>


Just populating the dropdown using the collection.

Now i want to apply a red color for a particular option value.

( Assume the values in the list value is USA,Brazil,Italy now i have to apply green color to the USA option).

Any help ?


 
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this belongs in the Struts forum.

Anyway, if you look at the generated HTML you will see a series of option tags. So what you need to do is set the background color for the desired option tag. You could do this by applying a style based on the tag id.
 
Author and ninkuma
Marshal
Posts: 66787
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.

Also, please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!