• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

change font size in struts

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Could anybody tell me how to change the font size of the <html:text/>tag?
I tried this <font size=18><html:text property="name"/></font>
But it does not seem to work.
Please help me!!!
 
Sheriff
Posts: 17703
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest using a CSS to define display characteristics like font and size. Then use the style and styleClass attributes of the Struts html tags.
 
YanJun Tong
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Junilu Lacar
Sheriff
Posts: 17703
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
YanJun Tong
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I do not think your approach works. anyway it is struts not normal HTML.
 
Junilu Lacar
Sheriff
Posts: 17703
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

styleClass="font-size: 12pt"

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.

styleClass="12pt"

BTW, I just tried it and it does work if you do it the way I show above. :roll:
 
YanJun Tong
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use "font-size: 12pt" you need the style attribute, not styleClass.
 
Junilu Lacar
Sheriff
Posts: 17703
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
YanJun Tong
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Junilu and Marc. Marc's approach does work!

Thank you very much
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Junilu deserves 99% of the credit.

I'm glad it works.
 
Junilu Lacar
Sheriff
Posts: 17703
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tong, glad you got it working

Marc, You're too modest...
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic