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. 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]

Reply via email to