Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners 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.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Minal Patil
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.
0 Answer(s)      2 years and 9 months ago
Posted in : Java Beginners


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?


Advertisement
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... to open the pdf file when i execute the jsp page...{ document.close();} %> </body> I added itextpdf jar 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... to open the pdf file when i execute the jsp page...{ document.close();} %> </body> I added itextpdf jar 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... to open the pdf file when i execute the jsp page...{ document.close();} %> </body> I added itextpdf jar 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... to open the pdf file when i execute the jsp page...{ document.close();} %> </body> I added itextpdf jar 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
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
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
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 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 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
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
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...); System.out.println(d); output=Sat Dec 17 19:31:51 IST 2011 Please can any one tell why
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
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
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 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. When
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
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 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
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"%> <
this is my file upload page, here i am not getting tags input field value to my servlet,please suggest a solution?
this is my file upload page, here i am not getting tags input field value to my...="file" name="file0"/> Tag Here <input id="tag1" type="text" name...; <script type="text/javascript"> var counter =1; function
:( I am not getting Problem (RMI)
I am not getting Problem (RMI)  When i am excuting RMI EXAMPLE 3,2 I am getting error daying nested exception and Connect Exception  
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"%> <
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"%> <
 

 

 

DMCA.com