text: .
  // Output a message to the log so we know that we'll be writing the text out to a file. session.log( "Writing data to a file." ); // Create a FileWriter object that we'll use to write out the text. out = new FileWriter( "form_submitted_text.txt", true ); // Write out the text. out.write( session.getVariable( "Identifier" ) ); out.write (", "); // Close the file. out.close();
  Add your voice to the tech community where 5M+ people just like you are talking about what matters.
  public class Lister { public static void main(String[] args) { String[] words = {"text1", "text2", "text3", "text4", "text5", "text6"}; int size = words.length; for (int x = 0; size > x; x++) { String currentWord = words[x]; int y = x % 3; if (y == 0 || y == 1) { System.out.print(currentWord +", "); } else { System.out.println(currentWord); } } } }
  session.log( "Writing data to a file." ); out = new FileWriter( "form_submitted_text.txt", true ); out.write( session.getVariable( "Identifier" ) ); // get or create WriteCount Integer writecount = session.getVariable("WriteCount"); if (writecount == null) { writecount = new Integer(0); } // increment WriteCount writecount = new Integer(writecount.intValue()+1); session.putVariable("WriteCount", writecount); // determine if line break or comma is needed if (writecount.intValue()%3 == 0) { new PrintWriter(out).println(); } else { out.write (", "); } out.close();
  If you are experiencing a similar issue, please ask a related question
  Join the community of 500,000 technology professionals and ask your questions.