Show animated numbers on the page

Source: Internet
Author: User
Show animated numbers on the page

Count. Java

Package COM. lpy; import Java. io. *; public class count {/** write count to the filename file */public static void writefile (string filename, Long Count) {try {printwriter out = new printwriter (New filewriter (filename); out. println (count); out. close ();} catch (ioexception e) {e. printstacktrace () ;}}/** read count from the filename file and return */public static long readfile (string filename) {file F = new file (filename ); long Count = 0; if (! F. exists () {// if the file does not exist, call writefile and merge it into 0 writefile (filename, 0);} Try {bufferedreader in = new bufferedreader (New filereader (f )); count = long. parselong (in. readline ();} catch (filenotfoundexception e) {e. printstacktrace ();} catch (ioexception e) {e. printstacktrace ();} catch (numberformatexception e) {e. printstacktrace ();} return count;}/** convert count into a string and read it into the  tag to replace it with a file name of 0, 1, 2 ...... */Public static string Tranform (Long Count) {string strcount = "" + count; string newstring = ""; for (INT I = 0; I <strcount. length (); I ++) {newstring + = " ";} return newstring ;}}

Index. jsp

<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <% @ page import =" com. lpy. count "%> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <HTML> 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.