:-)
http://jakarta.apache.org/struts/userGuide/struts-html.html#text
This does not let me localize or format.
Lets say I have a bean that has a #, String getStartDate().
If I sometimes use this bean on a read only page, I could do JSP FMT to format and localize.
I sometime want to use the same bean on a R/W form submit page.
String getStartDate(), hut html:text does not format or localize. The traditional approach I used was to format to native types inside the setters/getters.
Point is I can't format a localize in html:text, but can in JSTL.
So the only place is in the bean, inside the getStartDate() {}.
The other alternative is to copy.
And I must have misunderstood what you were saying, but I think I now understand the issues surouding it enough.
.V
Martin Cooper wrote:
"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 CooperSo 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 thebean,and why is it different if the page is read-only? You should be able touseJSTL to do this in either case. -- Martin CooperSo 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.Trythe 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 theabovepage is: $1,234,567,890.00 The <fmt:formatNumber> tag did its job just fine when passed a string instead of an integer. -- Martin CooperSo 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 createabean 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 FMTtag..V Also, it be nice if tiles was able to do some EL, or have a nicer wayofFORWARDING to diferent JSP from the tile action one day.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]