jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject Re: JSTL formatting inside HTML form elements
Date Sun, 31 Mar 2002 04:57:49 GMT
On Thu, 28 Mar 2002 Brennan.O'Shea@alltel.com wrote:

> I've been looking at the formatting (localization) aspects of the JSTL
> <fmt:*/> tags and I'm wondering what approach others have taken with
> regards to displaying localized data inside HTML form elements.  For
> example, what if I have a currency that needs to be localized inside
> of an HTML text box.  I suppose I could use the <fmt:formatNumber/>
> tag inside the 'value' attribute of the <input type="text"/> element

Right, this would work fine, except for the situation you raise (where
you're wrapping an HTML form component with a JSP custom tag).

> -- but what if I am already using a tag that is creating that input
> box for me? Should I just take the formatting code inside the <fmt:*/>
> tags and place that in my HTML components tags?  What approach are
> others taking to localizing (and de-localizing) data within HTML form
> elements?

If the tag that you're using can read data from scoped attributes, you can
use <fmt:formatNumber> and <fmt:formatDate> with a 'var' attribute to
store the formatted result in a scope.  Then, simply retrieve this result
when you need it.

-- 
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)


--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message