The moose likes Struts and the fly likes Customize html:label size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Customize html:label size" Watch "Customize html:label size" New topic

Customize html:label size

Erwan Lacoste

Joined: May 18, 2006
Posts: 1
Hi all,
I'm looking for a way to customize the html:label size according to the content.
example : lets say I need to print the word "FOO", my label tag should have the size "50". But if i print "FOOBAR", the size should be "100".
Any ideas?
thanx in advance.
Vani Bandargal
Ranch Hand

Joined: Oct 06, 2005
Posts: 82
If you want to do this dynamically on client side,say on change of some event then in Javascript you can check innerHTML td tag. (since you said lable, I assume that you are printing in td tag). Make sure that td has some id

if (document.getElementById("td_Id").innerHTML=='XXXX')
document.getElementById("td_Id").innerHTML='<font size=4>XXXX</font>';

if it is not on some event on client side then you can add font tag to the value on server side code itself.
If you use c out jstl, add escapeXML="false"
I agree. Here's the link:
subject: Customize html:label size
It's not a secret anymore!