Saving Forms to an XML file or .txt file
-
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
-
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
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); } }