File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to change color in the options using html:options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to change color in the options using html:options " Watch "How to change color in the options using html:options " New topic
Author

How to change color in the options using html:options

Senthil Mahalingam
Greenhorn

Joined: Jun 29, 2010
Posts: 3
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 ?


Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change color in the options using html:options