Two Laptop Bag
The moose likes Struts and the fly likes Struts html text size attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts html text size attribute" Watch "Struts html text size attribute" New topic

Struts html text size attribute

Stephanie Johnson

Joined: Jun 03, 2009
Posts: 8
I have defined a textbox in JSP as follows.
<html:text property="test" size="25" />

This gives me a textbox of visbile length 20 characters in upper case and 27 characters in lowercase in firefox.
By visible - I mean the total number of characters the user can see in the textbox without scrolling.
The lengths are different in IE.

Is there a way I can specify the textbox to show only 25 characters irrespective of whether it is upper / lower case or IE/firefox.
David Newton

Joined: Sep 29, 2008
Posts: 12617

The "size" attribute controls visual size; while "maxlength" controls the number of characters. If you want to control the size absolutely you're better off doing it in em/pixels/etc. to make it cross-browser.

Further discussion regarding input element sizing belongs in the HTML forum, as it doesn't really have anything to do with Struts.
I agree. Here's the link:
subject: Struts html text size attribute
It's not a secret anymore!