Stringutil. Java
Package COM. LH. bean; import Java. text. numberformat; public class stringutil {// defines the private int intvalue of the integer to be formatted; // The formatted string private string formatstr; // the minimum number of digits of the formatted string private int minimumdigit; // default constringutil () {} public int getminimumdigit () {return minimumdigit;} public void setminimumdigit (INT minimumdigit) {This. minimumdigit = minimumdigit;} public int getintvalue () {return intvalue;} public void setintvalue (INT intvalue) {This. intvalue = intvalue;} Public String getformatstr () {// obtain the numberformat NF = numberformat, a regular value format object. getinstance (); // sets the minimum number of bits in the integer part of the formatted number. setminimumintegerdigits (minimumdigit); // return the formatted string and replace "," with return NF. format (intvalue ). replace (",", "");} public void setformatstr (string formatstr) {This. formatstr = formatstr ;}}
Index. jsp
<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <HTML>
Format. jsp
<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <HTML>