But I'm puzzled why Stephen's original approach doesn't work.

>From a brief look at the code, the f:convertNumber will attach a
NumberConverter instance to the object that is used to map
number->string.

The NumberConverter simply uses the javax.text.NumberFormat class for
conversions. The sun javadocs are fairly vague, but I would have thought
that 
  NumberFormat.setMaximumFractionDigits 
(which is what the converter is calling in this case) would do what
Stephen already wants, or at least have some effect on the output!

Stephen, you might like to try writing a trivial test app to see how the
javax.text.NumberFormat.setMaximumFractionDigits method actually affects
later calls to
  NumberFormat.format(new Double(6.977777));

BTW, you might need to specify a "rounding mode" for the NumberFormat to
get the output you want (6.97 --> 7)

Regards,
Simon

And although the sun javadocs for 
On Thu, 2008-05-15 at 10:32 -0600, Andrew Robinson wrote:
> I prefer the EL function approach, but a note that you can also use
> t:buffer to use outputFormat to format the text and then use the
> buffered value to put into the title.
> 
> On Thu, May 15, 2008 at 9:33 AM, Stephen Friedrich <[EMAIL PROTECTED]> wrote:
> > Create a getter in the backing bean that does the formatting (using 
> > java.text.DecimalFormat)?
> > If you don't want to change the backing bean, then create an EL function 
> > that does the formatting.
> >
> >
> > I am including a Double in the title of <t:outputText>.  The problem the
> >  default formating is undesired.
> > The tag:
> >  <t:outputText
> >     value="#{tripSummary.columnValue.idleSeconds.sum}"
> >     title="Mean idle time is
> > #{tripSummary.columnValue.idleSeconds.mean} minutes">
> >   <f:convertNumber maxFractionDigits="0" />
> >  </t:outputText>
> >
> > Displays "Mean idle time is 6.977777777777777 minutes"  as tool tip.
> >
> > I prefer "Mean idle time is 7 minutes".  The question is how can I
> > format the text?
> >
> > Paul Spencer
> >

Reply via email to