I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.

I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.

I am reading the file using BufferedReader, then writing the output like this:

String fileName = "C:\\M2011001582.TXT";
 BufferedReader is = new BufferedReader(new FileReader(fileName));
 int lineCount=1;
 String fileData = "";
 out.println("<table border=\"1\" ><thead>"
   + "<tr><th>  SNO </th>"
   + "<th>  Batch Number </th>"
   + "<th>  amount </th>"...</tr>);
 while((fileData = is.readLine()) != null)
 {
   out.println( "<tr>"
     + "<td>" + lineCount++ + "</td>"
     + "<td>" + fileData.substring(0,6) + "</td>" //batch no
     + "<td>" + fileData.substring(6,14) + "</td></tr>" ); //amount...
  }

The output displays 4 rows and 2 columns. How can I calculate the total amount?

View Answers









Related Tutorials/Questions & Answers:
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.  I am reading...... } The output displays 4 rows and 2 columns. How can I calculate the total
I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?
I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?  import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ReadFileExample
Advertisements
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import... file when i execute the jsp page... = window.adsbygoogle || []).push({}); I added itextpdf jar file to the libraries.the pdf file
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import... file when i execute the jsp page... = window.adsbygoogle || []).push({}); I added itextpdf jar file to the libraries.the pdf file
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import... file when i execute the jsp page... = window.adsbygoogle || []).push({}); I added itextpdf jar file to the libraries.the pdf file
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import... file when i execute the jsp page... = window.adsbygoogle || []).push({}); I added itextpdf jar file to the libraries.the pdf file
I am getting Undefined in Text Box Very Urgent - JSP-Servlet
I am getting Undefined in Text Box Very Urgent  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I got the coding. But I find... the value "Undefined" in Emp ID text box which is present in the main page.. Here's
I need jsp code for how to write text field value into property file.
I need jsp code for how to write text field value into property file.  Hi , I need to set the text field value into property file using jsp code. Example : Username : Valar , I have entered the value "Valar" in the text field
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
I want to display 10,000 records in a jsp page.Can I display page by page?
I want to display 10,000 records in a jsp page.Can I display page by page?  When I submit a form it says "ERROR: Query request too large. Total rows... print page by page or have say 900 records per page in a jsp? Should I have
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page  I have a .properties file. I have to create a jsp page such that it reads the data from this .properties file and display it in table format. Ex:by using
how can i display a pdf file in a jtextarea
how can i display a pdf file in a jtextarea  I need to display a pdf file in a jtextfield or in a jtextarea.Atlest i need to displat it in a jframe.I have a button and while clicking on it ,i need to choose the pdf file and need
I need Oracle connector jar file. where will i download?
I need Oracle connector jar file. where will i download?  I need Oracle connector jar file. where will i download
Do I need math for data science?
Do I need math for data science?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Do I... so that I can learn the topic "Do I need math for data science?"
What skills do I need to be a data analyst?
What skills do I need to be a data analyst?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: What skills do I need to be a data analyst? Try to provide me good
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
I have doubt in jsp file.
I have doubt in jsp file.  I have doubt in jsp file. In a jsp file, there should be two buttons. One is start and other is stop. When we click on start then only stop should be enabled. Other wise it should be disabled
i need the source code to generate id in jsp
i need the source code to generate id in jsp  hai,i need the source code for generate id...which is i need to generate the new id from the maximum+1,like automatically when i click the button...as well i have several kinds
i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need for this
i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need for this   i have one txt field and one button.when i entere any test in testfield then only button should
i am getting the problem when i am downloading the pdf file from oracle 10g database - Struts
i am getting the problem when i am downloading the pdf file from oracle 10g database  if i created the pdf file from pdf machine,it is storing into datbase and download the pdf file from database. but when i created the pdf file
Text File I/O - DVD.java - Java Beginners
Text File I/O - DVD.java  NEED HELP PLEASE. The application should use a text file with one value on each line of the file. Each movie would use... starts, read the data file and populate the array. When the file ends, use
Which extension i use for save hibernate file.
Which extension i use for save hibernate file.   Please give me answer that which extension i use for save the hibernate file and how i run that file as well as complie that file.   hi friend, Naming convention
I am not able to display the selected value of my combobox
I am not able to display the selected value of my combobox   <... units order by unitcode"; $rsrcResult = mysql_query($strQuery); $i=1..._assoc($rsrcResult)) { $strA = $arrayRow[$i]; $strB = $arrayRow
I am writing a program which converts a string to a timestamp and add days to it
I am writing a program which converts a string to a timestamp and add days to it  java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2012-01-11 12...({}); output=Sat Dec 17 19:31:51 IST 2011 Please can any one tell why this is coming
a jsp code for creating a text file
a jsp code for creating a text file  Hello,i need jsp code for creating a new text file for each user, when they login in to the website for creating a new data file. So i need a jsp code for following options. when user login
I need to display parts of my own website on another website in an iframe
I need to display parts of my own website on another website in an iframe  I need to display parts of my own website on another website in an iframe. please refer me how do i do
I need an example of sessionfactory
I need an example of sessionfactory  Hi, I need an example of session factory in hibernate. If you can provide me one with, that would be great...Thanks
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations  <%@page import="java.sql.SQLException"%> <%@page import="com.rajsoft.CAF.util.DBconnection"%> <%@page import="java.sql.Statement"%> <
hello there i need help
hello there i need help  : i need to do a program like... because i am a beginner, and aside from that i am really eager to learn java please help me with the codes and please explain to me how it works. i only need
I am getting this exception
I am getting this exception   Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java
Jsp error when i run this a jsp file
Jsp error when i run this a jsp file  hi I got this error when i run the jsp file in IDE and outside also please help me java.lang.NullPointerException org.apache.jsp.insertjsp.jspInit(insert_jsp.java:22
i need help - Development process
()); } } } it is printing the result of ping in to a file,but if i want to maintain two files in which one file will be for the reply arrived and the other...i need help  hello, i need help regarding this program. public
I am good in programming. Can I make career in Big Data and Hadoop?
I am good in programming. Can I make career in Big Data and Hadoop?  Hi, I am a Java programmer with experience in Java, Advanced Java, JSP, Servlet... applications. Can I make career in Big Data and Hadoop? Thanks   Hi
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.  I am using postgresql-8.4.4-1... netbeans-6.1-ml-windows.How can I set up connection to database? Please help me
File I/O
File I/O  i am trying to read and write a 54mb text file from one directory to another. I managed to do it perfectly using the examples i was given... question is, is their away i can read and write in the shortes time possible(in seconds
display all words containing the letter which i gave as input...
display all words containing the letter which i gave as input...  If i enter any character,it have to display the names which having that character..write a program using java example(output) Enter any character: a Names: Abi
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
Do I need a Masters/PhD to become a data scientist?
Do I need a Masters/PhD to become a data scientist?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Do I need a Masters/PhD to become a data scientist? Try to provide
I am new to ML/AI. Where do I start learning?
I am new to ML/AI. Where do I start learning?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: I am new to ML/AI. Where do I start learning? Try to provide me good
i need project
i need project  can u send online shoppin project 2 my mailid.   Please visit the following links: Struts2 Shopping cart (adsbygoogle = window.adsbygoogle || []).push({}); JSP-Servlet Shopping cart
File I/O
File I/O  i am trying to read and write a file. my program works perfectly i am using PrintWriter and BufferedReader. but my problem is that when... like this input file blahblah i am a computer i am running windows i am
I am trying to create domains for column attributes of my data dictionary?
I am trying to create domains for column attributes of my data dictionary?  Please provide me with the best possible solution. I already have the fields and there data types in a table and then the field values in another table
ModuleNotFoundError: No module named 'will-i-am'
ModuleNotFoundError: No module named 'will-i-am'  Hi, My Python... 'will-i-am' How to remove the ModuleNotFoundError: No module named 'will-i... have to install padas library. You can install will-i-am python with following
How do I read a large file quickly in Java?
How do I read a large file quickly in Java?  Hi, I my project I have to read vendor feed which comes in text file. Size of the file is usually in 1-2 GB in size. What is the best way to read the file efficiently? How do I read
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer... (for n=0) for example, 5!=5.4.3.2.1, which is 120 a) Write an application...=input.nextInt(); long num=m; for(int i=m;i>1;i
File I/O
File I/O  greetings i was running into a problem. is their a way to read multiple files from one and write the in a different directory one by one...(); File[] files = file.listFiles(filter); for (int i = 0; i <
How I Upload File and Store that file name in Database using JSP
How I Upload File and Store that file name in Database using JSP  Hi All, I m the beginner in JSP and I want to upload the file and store that file and some other form data in MySQL database. Ex. There is one employee detail
How can i read a file from nth line onwards in java
How can i read a file from nth line onwards in java  Hi, I need to read a file content from its nth line onwards till end. How can i implement it in java. Regards, Chinnu

Ads