Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: In jsp page After decimal i need only 2 values(for ex:477.74)

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default In jsp page After decimal i need only 2 values(for ex:477.74)

    Hi Guys,
    I displaying report for work wise progress in jsp. At end of line i calculating total amount of Contract . In my result it is displaying 477.74999999994. For reference you can see attached screen shot file. But i want result in this format 477.74(i dont want to be round off).
    I attached jsp page for your reference .
    Please help me & need code for that
    Attached Images Attached Images
    Attached Files Attached Files


  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: In jsp page After decimal i need only 2 values(for ex:477.74)

    Read the API docs for java.text.DecimalFormat, it has a bit on rounding which may solve your problem.

Similar Threads

  1. Converting Hex to Decimal
    By r2ro_serolf in forum Java Theory & Questions
    Replies: 10
    Last Post: September 4th, 2011, 04:29 PM
  2. decimal and hexdecimal
    By ran830421 in forum Java Theory & Questions
    Replies: 3
    Last Post: November 21st, 2009, 02:58 AM
  3. Get <SELECT> tag values on other jsp page
    By nehakuls in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: November 18th, 2009, 02:29 AM
  4. decimal to hex
    By rsala004 in forum Algorithms & Recursion
    Replies: 1
    Last Post: November 3rd, 2009, 02:16 AM
  5. [SOLVED] How to use decimal place when formatting an output?
    By napenthia in forum Java Theory & Questions
    Replies: 2
    Last Post: April 27th, 2009, 03:17 AM