This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi thanks for your reply.This approach does work in <html:text/>tag. However I found it doesnot work in <html:select/>tag.My code is as follows: <html:select property="handed" styleClass="12pt"><html ption value="Left" styleClass="12pt">Left</html ption><html ption value="Right" styleClass="12pt">Right</html ption><html ption value="Ambidextrous" styleClass="12pt">Ambidextrous</html ption></html:select> The font size in option box does not change. Thanks
Your attribute values are probably what's wrong. Nothing to do with Struts. A quick search with Google turned upthis article which shows the proper way to specify the style. [ August 13, 2004: Message edited by: Junilu Lacar ]
Joined: Jun 11, 2003
Hi I do not think your approach works. anyway it is struts not normal HTML.
Originally posted by YanJun Tong: Hi I do not think your approach works. anyway it is struts not normal HTML.
Ok, you don't think it works but did you actually read the article I cited and try specifying the styleClass attribute as
It doesn't matter if you use Struts or normal HTML: this has nothing to do with how the response (which is HTML either way) is rendered in your browser. The issue is the way you are specifying the value for the style attribute. The way you are doing it is simply incorrect.
BTW, I just tried it and it does work if you do it the way I show above. :roll:
Joined: Jun 11, 2003
Thanks for your reply. I tried it again as follows: <html:select property="gender" styleClass="font-size: 12pt"><html ption value="Male" styleClass="font-size: 12pt">Male</html ption><html ption value="Female">Female</html ption></html:select> However it still does not seem to work. I also tried it in the <html:text/> tag, unfortunately it does not work either.
By the way in my approach styleClass="pt12", pt12 is the class name in my css file.
OK, my bad. Marc is right, you should use the style attribute instead of styleClass in your Struts tag. The styleClass attribute renders a "class" attribute in the response, not "style" as I thought.
You only need to specify the style or styleClass in the html:select tag. It would also be easier if you post the style class definition that you are using so we can try it out because this seems to work fine for me in IE (although I think that "12pt" is a bad name: what if you want to change it again in the future? Then the 12pt style class would be actually rendering 6pt, for example):
Yes, I know, it is HTML but your JSP will get rendered pretty much the same way. [ August 17, 2004: Message edited by: Junilu Lacar ]