How to add data in a file

hi,
I have written following code.I have a file. i want to add data in this file.
When i add data then data is added but i donnot get the previous data. What`s the problem of my code? Is there anyone can help me? how i will add data with the previous data? Please help me.
String username=request.getParameter("UserName");
String userage=request.getParameter("UserAge");
String address=request.getParameter("UserAddress");
String sex=request.getParameter("sex");
FileWriter f = new FileWriter("d:\\download_dreamweaver\\Project_3\\WebContent\\SaveData.txt");
f.append(username);
f.close(); ith regards
bina

Looks like you're creating a new file (which overwrites the old one) every time. You need to open the file first and then append to it.

Similar Messages

  • How to add data in xml file

    Hi ALL
    I want to add new fields on seeded EBS page to store their values in hr_api_transaction table whoch contain information of other fields on that page which are seeded
    but that table has one column which stores xml file and that xml file has all information about that page's fields
    how can I store my custom fields values in that xml file ?

    Hi,
    As Andy said,  add data to an xml file is overwriting, if you mean append data to xml file, please look this article:
    http://codesamplez.com/programming/linq-to-xml-tutorial, Since this issue is more related to ASP.net, you could also ask this issue in asp.net forum:
    http://forums.asp.net/
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How generate a XML file & how to save data in that file?

    hi,
    How to generate an xml file & how to add data in that xml file? is there anyone who can help me about this? Firstly i need to open a xml file and after that i need to save user data in that file? how i will do it? What will be the solution of this? please give me solution........
    with regards
    Bina

    With an API like Xerces you can parse an XML document into a DOM tree. You can do modifications on that tree manually and then write it back out as XML data.
    http://xerces.apache.org/xerces2-j/

  • How to add date with month after convert number to month?

    How to add date with month after convert number to month?
    Month Date Result
    24 21/11/09 24*(21/11/09)
    I want to add both the column and result should be 21/11/11
    Thanks
    Nihar

    Hmm,
    Because, you are using YYYY for '09'.
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/2009
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/0009Or with Add_months
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/0012
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/2012-Arun

  • Pls Help me with steps to add data from xml file to SAP B1 through B1iSN.

    Pls Help me with steps to add data from xml file to SAP B1 through B1iSN. I  am getting stuck in xsl transformation. not able to understand where the mapping code needs to be added.
    Pls explain me the steps for adding data from xml to B1 quotation step by step.
    thanks and regards
    Priya

    Hi,
    Have you checked this: https://sap.na.pgiconnect.com/p45508295/?launcher=false&fcsContent=true&pbMode=normal ?
    Thanks,
    Gordon

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to output data to a file in SCC-SG04?

    I am using SCC-2345 with SCC-SG04 connected to NI-6221 in Windows 2000 in VC6.
    How to output data to a file like data1.dat in VC6 or in Labwindows/CVI?

    Hello mwibm,
    If you just want to do file input/output in LabWindows/CVI, I would take a look at the Formatting and I/O CVI library or the ANSI File I/O functions. For example, if you just want to write an array of data to a file, I would look at the ArrayToFile function or the fwrite/fputs/fprintf ANSI C functions included in stdio.h. The ANSI C functions will also work in Visual Studio. More information on the LabWindows/CVI File I/O functions can be found in CVI help, and more information on ANSI C functions can be found in CVI Help and online at various websites.
    Maybe you could further clarify what problems you are having and what kind of data you want to write to a file.
    Thanks.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

  • How to share data in cfc files?

    I can save shared data (like dsn) in application.cfm so all
    the cfm file can read it.
    But how to share data in cfc files like application.cfm. I
    hear application.cfc,may I use it share data in cfc files?
    Do you think if it is ok that application.cfm and
    application.cfc exist in the site?
    Thanks
    Mark

    quote:
    Originally posted by:
    mark416
    I can save shared data (like dsn) in application.cfm so all
    the cfm file can read it.
    But how to share data in cfc files like application.cfm. I
    hear application.cfc,may I use it share data in cfc files?
    Do you think if it is ok that application.cfm and
    application.cfc exist in the site?
    Thanks
    Mark
    Don't use both. Things like a dsn are best defined in the
    onApplicationStart method of an application.cfc.

  • How to add the mail.jar file to my CLASSPATH ?

    Hi;
    I wish to Instal JavaMail 1.2
    To use the JavaMail 1.2 API, i unbundle the javamail-1_3_1-upd.zip file.....and now, i would like to add the mail.jar file to your CLASSPATH.
    My question is: how do you do this ?
    - ok i did that for CATALINA_HOME & JAVA_HOME but how to add the mail.jar file to my CLASSPATH ??
    1000 thanks.

    I think you're looking for "developer support", not packaged application support. different server, different batch of groups. . .
    Since I have very little contact with devopers, I don't truly know.

  • How to add other 2 control files at ASM in linux RAC

    Hi Experts,
    I am new for RAC .
    the vendor build a RAC for us. I found there are only one control file in system.
    we use oracle 10.2.0.4 at ASM with RAC in redhat linux 5.
    how to add 2 additional control file to ASM for RAC ?
    Please provide a procedur in detail.
    Thanks
    Jim

    Hi damorgan & Friends,
    I could not find some infomration to add control into ASM . I can do this job( see below procedure) in no ASM .
    My question, our database locates at ASM and control file with a system auto-number ( fully qualified filename ) as
    +DATA1/SALE/controlfile/current.256.690290159
    How do I physical copy and rename other 2 contril file in directory and modify location in pfile?
    I saw some paper to use request as an alias (such as +dgroup2/control/ctl.f). i can not image to copy/rename control.
    Please help me!!
    Thanks
    Jim
    ========added control file for no ASM database and works=====================
    1)
    SQL> create pfile from spfile;
    File created.
    2)
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL
    3)
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    4) modify pfile add additional control file2/3 as
    control_files='C:\Oradata\ORCL\control01.ctl','C:\Oradata\ORCL\control02.ctl','C:\Oradata\ORCL\control03.ctl'
    and physical copy control01.ctl and raname as control02.ctl,control03.ctl
    5)
    SQL> startup pfile='C:\oracle\product\10.2.0\db_2\database\initORCL.ora';
    ORACLE instance started.
    Total System Global Area 167772160 bytes
    Fixed Size 1247900 bytes
    Variable Size 62915940 bytes
    Database Buffers 100663296 bytes
    Redo Buffers 2945024 bytes
    Database mounted.
    Database opened.er database mount;
    6)
    SQL> Create spfile from pfile='C:\oracle\product\10.2.0\db_2\database\initORCL.ora';
    File created.
    7) check control file info under pfile environment
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL,
    C:\ORADATA\ORCL\CONTROL02.CTL
    , C:\ORADATA\ORCL\CONTROL03.CT
    L
    8)SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    9) startup as spfile environment.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 167772160 bytes
    Fixed Size 1247900 bytes
    Variable Size 62915940 bytes
    Database Buffers 100663296 bytes
    Redo Buffers 2945024 bytes
    Database mounted.
    Database opened.
    10) check control info for spfile environment
    SQL> show parameter spfile
    NAME TYPE VALUE
    spfile string C:\ORACLE\PRODUCT\10.2.0\DB_2\
    DATABASE\SPFILEORCL.ORA
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL,
    C:\ORADATA\ORCL\CONTROL02.CTL
    , C:\ORADATA\ORCL\CONTROL03.CT
    L

  • How to extract data from XML file with JavaScript

    HI All
    I am new to this group.
    Can anybody help me regarding XML.
    I want to know How to extract data from XML file with JavaScript.
    And also how to use API for XML
    regards
    Nagaraju

    This is a Java forum.
    JavaScript is something entirely different than Java, even though the names are similar.
    Try another website with forums about JavaScript.
    For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3

  • How to write data to text file using external tables

    can anybody tell how to write data to text file using external tables concept?

    Hi,
    Using external table u can load the data in your local table in database,
    then using your local db table and UTL_FILE pacakge u can wrrite data to text file
    external table
    ~~~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
    UTL_FILE
    ~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
    Message was edited by:
    Nicloei W
    Message was edited by:
    Nicloei W

  • How to add list of multiple file types to file type of file dialog box in LabVIEW

    How to add list of multiple file types to file type of file dialog box in LabVIEW?
    In file dialog box there is option to add only one file type,in the list,not by seperating commas,
    regards,
    Naresh.N

    Write the file types in pattern Input string, separated by a semicolon ;
    For example:  *.vi;*.doc;*.jpeg;*.xls
    This should return the set of files with matching extensions
    Message Edited by devchander on 09-10-2008 08:02 AM
    Message Edited by devchander on 09-10-2008 08:03 AM

  • Add-Data-To-End-File

    hi every one
    i been two days seeking help about my problem but no one seems to reply
    my problem is very simple but becouse i am new on dealing with files i could not solve the following problem :
    i am trying to add data to a file hello world , and the blow code actully does the job for me but on the other hand it deletes the file current data stored on theat file
    what i am trying to say i want from the code to allow new data to enter the file at the end of it withot deleting any thing (overwritting)
    could you please help
    thanks
    the code:
    import java.io.*;
    public class add {
      static public String getContents(File aFile) {
          StringBuffer contents = new StringBuffer();
         BufferedReader input = null;
        try {
          input = new BufferedReader( new FileReader(aFile) );
          String line = null;
          while (( line = input.readLine()) != null){
            contents.append(line);
            contents.append(System.getProperty("line.separator"));
        catch (FileNotFoundException ex) {
          ex.printStackTrace();
        catch (IOException ex){
          ex.printStackTrace();
        finally {
          try {
            if (input!= null) {
              input.close();
          catch (IOException ex) {
            ex.printStackTrace();
        return contents.toString();
      static public void setContents(File aFile, String aContents)
                                     throws FileNotFoundException, IOException {
        if (aFile == null) {
          throw new IllegalArgumentException("File should not be null.");
        if (!aFile.exists()) {
          throw new FileNotFoundException ("File does not exist: " + aFile);
        if (!aFile.isFile()) {
          throw new IllegalArgumentException("Should not be a directory: " + aFile);
        if (!aFile.canWrite()) {
          throw new IllegalArgumentException("File cannot be written: " + aFile);
        Writer output = null;
        try {
          output = new BufferedWriter( new FileWriter(aFile) );
          output.write( aContents );
        finally {
          if (output != null) output.close();
      public static void main ( String[] aArguments ) throws IOException {
         File testFile = new File("test.xml");
          setContents(testFile,"hello world");
        System.out.println( "File contents: " + getContents(testFile) );
    }

    Hi
    and thanks for your help
    but i still having difficultties to make it work also i got some ideas from your website
    and the final code is the following :
    could you have a look
    thanks
    import java.io.*;
    public class test {
      static public String getContents(File aFile) {
          StringBuffer contents = new StringBuffer();
         BufferedReader input = null;
        try {
          input = new BufferedReader( new FileReader(aFile) );
          String line = null;
          while (( line = input.readLine()) != null){
            contents.append(line);
            contents.append(System.getProperty("line.separator"));
        catch (FileNotFoundException ex) {
          ex.printStackTrace();
        catch (IOException ex){
          ex.printStackTrace();
        finally {
          try {
            if (input!= null) {
              input.close();
          catch (IOException ex) {
            ex.printStackTrace();
        return contents.toString();
      static public void setContents(File aFile, String aContents)
                                     throws FileNotFoundException, IOException {
        if (aFile == null) {
          throw new IllegalArgumentException("File should not be null.");
        if (!aFile.exists()) {
          throw new FileNotFoundException ("File does not exist: " + aFile);
        if (!aFile.isFile()) {
          throw new IllegalArgumentException("Should not be a directory: " + aFile);
        if (!aFile.canWrite()) {
          throw new IllegalArgumentException("File cannot be written: " + aFile);
        Writer output = null;
        try {
          output = new BufferedWriter( new FileWriter(aFile) );
          output.write( aContents );
        finally {
          if (output != null) output.close();
      public static void main ( String[] aArguments ) throws IOException {
    byte[] bytes = null;
                 try {
                     RandomAccessFile raf = new RandomAccessFile( "test.xml", "rw" );
                     bytes = new byte[ (int) raf.length() ];
                     raf.seek( raf.length() );
                    raf.write
                   setContents(rdf,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
                   System.out.println( "File contents: " + getContents(rdf) );
                     raf.close();
                 catch( IOException e ) {
                     System.err.println( e );
                     System.exit( 1 );
                 System.out.println( new String(bytes) );
                 System.exit( 0 );
    }

  • How to insert data from *.dmp file to  oracle 11g using Oracle SQL Develope

    hi
    i backup my database using PL/SQL developer and made *.dmp file
    how to insert data from *.dmp file to oracle 11g using Oracle SQL Developer 2.1.1.64
    and how to make *.dmp file from sql*plus ?
    thanks in advance

    Pl/Sql developer has a config window, there you choose the exec to do the import/export.
    Find it and his home version, it may be exp or expdp, the home version is the version of the client where the exp executable is.
    Then use the same version of imp or impdp to execute the import, you do not need to use Oracle SQL Developer 2.1.1.64. If you want to use it, you must have the same version in the oracle home that exp/imp of sql developer use.

Maybe you are looking for

  • I was sharing apple id with husband on our iPhones but now we want to each have our own, how can i do this without having all his info on his phone be lost?

    When husband and i got our iPhones we shared the same Apple ID but not that we have added an iPad and Mac he wants his own apple ID how can I change the apple id/icloud to his own without deleting all his phone and resetting?

  • How can I delete all my photos from my iphone ios8

    I have backed up all my photos from my Camera Roll on my computer. I know wish to free up that space. It is 1300 photos. I do not have time to sit and tap through each moment and delete. Too many moments. There must be a quicker way to delete all pho

  • Mac OS x 10.5.6 PSE 6 Paste Anomaly

    Try the following steps: 1. Open a pdf file using Preview. 2. Choose the rectangular selection tool 3. Select a portion of a page. 4. Do a copy (command C) 5. Verify that the clipboard contains the area you selected by: a. Going to Finder > Edit > Sh

  • From PDF into BMP

    Hello, I'm looking for a easy-to-use tool/library to be integrated into my application that is able to render a PDF page into a bmp or similar lossless image file format. Is there anybody of you guys, that can suggest me some handy product coming dir

  • Safari can't find Adobe Reader

    When I go to load a pdf file in Safari a dialog window opens wanting me to direct it to Adobe Reader. This started to happen when I deleted Reader 7.0.5 and installed a fresh copy of Reader 7.0.7. Any suggestions on how to fix this?