Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Saving Forms to an XML file or .txt file

Saving Forms to an XML file or .txt file

Scheduled Pinned Locked Moved Java
javahtmldesignxmlhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Clement Tientcheu
    wrote on last edited by
    #1

    Hey Everyone I am learning Java and would like to know how to get started on writing a piece of code that takes a collection of objects (which are answers from a form) and save it in a file (xml or .txt) the FORM can be design from any visual editor (Flex, SWING, HTML, JSP etc...) but once the form has been filled out, I want to save all the answers in a xml or .txt file Any help would be greatly appreciated thanks

    S 1 Reply Last reply
    0
    • C Clement Tientcheu

      Hey Everyone I am learning Java and would like to know how to get started on writing a piece of code that takes a collection of objects (which are answers from a form) and save it in a file (xml or .txt) the FORM can be design from any visual editor (Flex, SWING, HTML, JSP etc...) but once the form has been filled out, I want to save all the answers in a xml or .txt file Any help would be greatly appreciated thanks

      S Offline
      S Offline
      sparlay_pk
      wrote on last edited by
      #2

      public void saveAnswers() { try { FileWriter fw = new FileWriter("Questions.txt"); PrintWriter pw = new PrintWriter(fw); pw.println(textBox1.getText()); pw.println(textBox2.getText()); pw.println(textBox3.getText()); pw.println(textBox4.getText()); pw.flush(); } }catch(Exception e) { System.out.println(e); } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups