Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » number formatting in JSP
number formatting in JSP [message #204201] Tue, 10 April 2007 16:20 Go to next message
Eclipse User
Originally posted by: b0pror00t0r.hotmail.com

Hello!
I'm trying to display correctly formatted prices in an table (using JSP)
System.out.printf("%2.2%n",price); displays it correctly in the console.
What would I need to do to show it formatted correctly in the outputted
HTML?

Stugan


<TR>
<TD><font color="#FFFFFF"><%= code %></TD>

<TD><font color="#FFFFFF"><%= description %></TD>

<TD><font color="#FFFFFF"><%= currentLevel %></TD>

<TD><font color="#FFFFFF"><%= reorderLevel %></TD>

<TD><font color="#FFFFFF"><% System.out.printf("%2.2f%n",price); %></TD>

</TR>
Re: number formatting in JSP [message #204250 is a reply to message #204201] Tue, 10 April 2007 19:56 Go to previous messageGo to next message
Eclipse User
Originally posted by: nowhere.a.com

Stugen Palma wrote :
> Hello!
> I'm trying to display correctly formatted prices in an table (using JSP)
> System.out.printf("%2.2%n",price); displays it correctly in the console. What
> would I need to do to show it formatted correctly in the outputted HTML?
>
> Stugan
>
>
> <TR>
> <TD><font color="#FFFFFF"><%= code %></TD>
>
> <TD><font color="#FFFFFF"><%= description %></TD>
>
> <TD><font color="#FFFFFF"><%= currentLevel %></TD>
>
> <TD><font color="#FFFFFF"><%= reorderLevel %></TD>
>
> <TD><font color="#FFFFFF"><% System.out.printf("%2.2f%n",price); %></TD>
>
> </TR>

String.format("%2.2f%n",price);

--
Wojtek :-)
Re: number formatting in JSP [message #204281 is a reply to message #204201] Tue, 10 April 2007 22:15 Go to previous message
Eclipse User
Originally posted by: eclipse5.rizzoweb.com

Stugen Palma wrote:
> Hello!
> I'm trying to display correctly formatted prices in an table (using JSP)
> System.out.printf("%2.2%n",price); displays it correctly in the console.
> What would I need to do to show it formatted correctly in the outputted
> HTML?

This is not an Eclipse-related question and would be better served on a
JEE or JSP forum. Please restrict postings to this newsgroup to
Eclipse-related content.
Having said that, to help you out I will point you to JSTL which
contains formatting tag that do exactly what you want. Google for "JSTL
format tag" and you'll find it.

Hope this helps,
Eric
Previous Topic:CDT - attach/use profiling tools
Next Topic:adding a view in project explorer
Goto Forum:
  


Current Time: Mon Sep 22 14:30:55 GMT 2014

Powered by FUDForum. Page generated in 0.02119 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software