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



Home Answers Viewqa JSP-Servlet Problem with appending data to the end of file
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Stany Simon
Problem with appending data to the end of file
0 Answer(s)      2 years and 7 months ago
Posted in : JSP-Servlet


MY JSP CODE WITH THE JAVA CLASS: JSP CODE:

<html>
<body>
<%@ page language="java" import="java.io.*,data.*" %>
<%
String name=request.getParameter("name");
String mail=request.getParameter("email");
%>
<%
ServletContext sc=getServletContext();
String path=sc.getRealPath("mailList.txt");
musicja ja=new musicja();
ja.add(name,mail,path);
out.println("<h1>Ur name has been added successfully</h1>");
%>
</body>
</html>

JAVA CLASS FILE CODE:

package data;

import java.io.*;
import java.util.*;

public class musicja
{
public static void add(String name,String mail,String path) throws IOException
{
File f=new File(path);
PrintWriter p=new PrintWriter(new FileWriter(f,true));
p.println(name+"|"+mail+"|");
p.close();
}
}

My problem is that everytime i enter the data(via the browser),the data that i entere is printed on the text file(mailList.txt),but the data doesn't append,in the sense,everytime the previous data is deleted and the new data is printed in the file.Please do let me know if m missing something in the code or if i need to add something more.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Problem with appending data to the end of file
Problem with appending data to the end of file  MY JSP CODE... the data(via the browser),the data that i entere is printed on the text file..." import="java.io.*,data.*" %> <% String name=request.getParameter("name
writing and appending to a file
writing and appending to a file  My input file includes data from... and values and writes into an existing file for 'male'. How can I do the same... the new data fw.write("# Table" + Name + "\n" + "map
Advertisements
how to write to file at the end of the line
how to write to file at the end of the line  Hi, Where do i learn how to write to file at the end of the line using Java program. Plz suggest... will help you for "How to write the file at the end of line using Java language
Java check end of file
Java check end of file In this section, you will learn how to check that the file has been read till the end of file. Data has been read one by one from... data. This  indicates the end of file or eof condition. It depends
reached end of file while parsing and while expected
reached end of file while parsing and while expected  import java.io.*; public class temperature{ public static void main(String []args)throws IOException{ BufferedReader steffi = new BufferedReader (new
Java Write To File End Of Line
Java Write To File End Of Line In this tutorial you will learn how to write to file at the end of the line. Write to a file in which some contents are available already and you need to write the text at the end of line you may to use
Write a program in Java to append content at the end of an already existing file.
Write a program in Java to append content at the end of an already existing file.  Write a program in Java to append content at the end of an already existing file
generating mock data class of times (start and end time and value)
generating mock data class of times (start and end time and value)   Using the timertask function want to generate a set of mock data of times using the random DATE class and values for plotting on a graph using java. How
How we delete a data of database from front end jsp page
How we delete a data of database from front end jsp page   I make a website and featch a data from data base and now i want that a delete button put in front of a featched data and when i clicked on this button then the data
Example of appending to a String
Example of appending to a String  Hi, Provide me the example code of appending to a Java program. Thanks   Hi, Check the tutorial: How To Append String In Java? Thanks
Java error reached end of file while parsing
Java error reached end of file while parsing       Java Error reached end... an error i.e java error reached end of file while parsing as the class closing braces
Appending Strings - Java Tutorials
.style1 { text-align: center; } Appending Strings In java, the two main ways for appending string at the end are : First method is using += operator. Second method is using append()  method. In this section, we
bliffoscope data analsys problem
bliffoscope data analsys problem  Bliffoscope Data Analysis Problem... problem you have is detecting the Rejectos spaceships and slime torpedos, because... is. In other words, the data it provides is the equivalent of a black-and-white image
File Uploading Problem
File Uploading Problem  I have a file uploading code but it create problem $(document).ready(function(){ $('#upload').click(function(){ var...', dataType: 'json', url: 'myServlet', data:{path:fileName}, contentType
File Uploading Problem
File Uploading Problem  I have a file uploading code but it create problem $(document).ready(function(){ $('#upload').click(function(){ var...', dataType: 'json', url: 'myServlet', data:{path:fileName}, contentType
jTable data problem
jTable data problem  Hello. I have a code that read file and store...","Number"}; List<String> data=new ArrayList<String>(); String... that read file and store in arraylist and then convert to array(To use for table
Problem reading word file
Problem reading word file  Deepak you provide me code for extarcting equation from a word file and also to write in a word file.But when I again want to read preveously created word file(created by your code) it gives an error
Problem in inserting clob data in jsp
Problem in inserting clob data in jsp  how to insert any rich text editor data (which have more than 32766 characters) in a clob type column of oracle database with jsp
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project... is text and all others are of currency data type. If i enter 0 or null value in currency column and then try to retrieve data using my servlet coding
application context file problem
application context file problem  how to configure junit application context file with struts........? it is not finding sessionfactory method
extract data fom table when a button is clicked in front end page using mysql5.0 and tomcat6.0
extract data fom table when a button is clicked in front end page using mysql5.0 and tomcat6.0   sir, i want to extract data from table which is stored in mysql5.0 databse, when a button is clicked in front end page using
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end  hello i have a simple problem in jsp in the sense to get data from the database like oracle . I have created one jsp
Write data in doc file
Write data in doc file  How to write data or string in word file
struts jar file problem
struts jar file problem  hi.. I'm using struts-core-1.3.9.jar. it works well if am using ma application with internet but it shows me an error while initializing ActionServlet when i disconnected to Internet The error stack trace
Problem in getting file path in js
Problem in getting file path in js  hi, I am using ofbiz framework , How i can get the file path in javascript for input type = "file" and i am using only firefox not other browser. so please help me it is very important for me
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file... to insert data from file. To understand this example, we create a table 'Stu_Table
File and data sending
File and data sending  Can anyone please tell me how to upload a file along with some data into the server??I want to do it like the way they do...(file_data) values(?)"); fis = new FileInputStream(f); psmnt.setBinaryStream(1
problem while reading .csv file
problem while reading .csv file  I have a problem here..... i am reading a .csv extention file which has some value....but the problem is der is an amount column which contains , in between (eg) 3,899.00 which inturns creates
Problem in enctype="multipart/form-data" in JSP
Problem in enctype="multipart/form-data" in JSP  im using a page... the file itself when i click the submit button. im using enctype="multipart/form-data... the uploaded value. but the problem is the uploaded file is not stored
Insert Data From File
Insert Data From File       Insert Data From File is  used to insert data from file... to insert data from file. To understand this example, we create a table 'Stu_Table
problem on jsp, inserting data into table(mysql).
problem on jsp, inserting data into table(mysql).  hello friends, I have a problem in jsp.I want to insert data, which is given by user through... is in mysql.I want to use placeholder("?") to insert data into table.Plsssss help
 

 

 

DMCA.com