"Vic Cekvenich" <[EMAIL PROTECTED]> wrote in message b2uf0d$5gb$[EMAIL PROTECTED]">news:b2uf0d$5gb$[EMAIL PROTECTED]... > I would like to format in the JSP if possible (for both). > > Let me just restate what I think you are saying: > "Since JSTL can format strings, allways format and localize in the > formBean".
No, that doesn't make any sense. I'm saying "Since JSTL can format strings, always format and localise in the JSP page". I don't understand why you need to do any of it in the bean, hence my last message. > > So as you point out, I can format and localize both in the bean. (Ex: > formBean.setLocale(x) ) Um, I didn't point that out at all. -- Martin Cooper > So probably a better choice. > > But... since I like how the FMT tag works.... not sure what "best" > approach is. I almost want to cross post to JSPTag-user, see if Geary is > around. but it's really not that big a deal. > A student in a class asked why this was and I was stuttering, so I > posted to get it of my chest and maybe as a wish list for HTML-EL tag. > > You and Ted pointed out some things however. > > .V > > > > Martin Cooper wrote: > > "Vic Cekvenich" <[EMAIL PROTECTED]> wrote in message > > b2u5oq$p8b$[EMAIL PROTECTED]">news:b2u5oq$p8b$[EMAIL PROTECTED]... > > > >>Thanks as always Ted and Martin. > >>I would still have to format the number in the bean for Form, and > >>localize dates (for the Candian dates), etc in the bean class. If the > >>page is read only, I would format in JSP. > > > > > > I guess I don't understand. Why do you need to do formatting in the bean, > > and why is it different if the page is read-only? You should be able to use > > JSTL to do this in either case. > > > > -- > > Martin Cooper > > > > > > > >> So far getAge() and > >>getAgeInt() look ok. I wonder which way the faces tag will work. > >>(yes, if know, if I copied data for the form bean .... but if I have > >>nested and multi row and many to many, it's kind of a pain; one day I > >>will write reflection with dynaRowSet to clone nesting, localize, format > >>and put in basicPortal) > >>.V > >> > >>Martin Cooper wrote: > >> > >>>"Vic Cekvenich" <[EMAIL PROTECTED]> wrote in message > >>>b2t728$t7c$[EMAIL PROTECTED]">news:b2t728$t7c$[EMAIL PROTECTED]... > >>> > >>> > >>>>I have been nudging people toiwards JSTL. > >>>>A nice feature is FMT tag that formats the number, date, etc. in the > >>>>JSP. FMT tag needs the formBeans to return int! > >>> > >>> > >>>No, it does not. If you provide a string to the format tags, such as > >>><fmt:formatNumber>, it will convert it to the appropriate numeric type. > > > > Try > > > >>>the following: > >>> > >>>----- cut here ----- > >>><%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> > >>> > >>><% > >>> request.setAttribute("foo", "1234567890"); > >>>%> > >>> > >>><fmt:formatNumber value="${foo}" type="currency"/> > >>>----- cut here ----- > >>> > >>>To avoid any question of what other JSTL tags might be doing, I've > >>>explicitly stored a string in a request attribute. The output from the > > > > above > > > >>>page is: > >>> > >>>$1,234,567,890.00 > >>> > >>>The <fmt:formatNumber> tag did its job just fine when passed a string > >>>instead of an integer. > >>> > >>>-- > >>>Martin Cooper > >>> > >>> > >>> > >>> > >>>>So if one does a FORM for updates you create formbean with String > >>>>getAge(), and number formated in Java before returning the String. > >>>> > >>>>If then you just want to display the # (no update) you need to create a > >>>>bean with int getAge(), and FMT it in JSP. > >>>> > >>>> > >>>>So return int for JSTL and String for formBean. > >>>> > >>>>A prefered solution is that HTML tag is able to do formating like FMT > > > > tag. > > > >>>> > >>>>.V > >>>> > >>>>Also, it be nice if tiles was able to do some EL, or have a nicer way of > >>>>FORWARDING to diferent JSP from the tile action one day. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]