Results 1 to 4 of 4

Thread: CSV file writer

  1. #1
    nida is offline Member
    Join Date
    Mar 2009
    Posts
    14
    Rep Power
    0

    Default CSV file writer

    Hello,
    i am using struts2 , i have to write the data from a list into csvfile following is the method used for writting the data:

    public void writeAlldata(List list) {
    for (Iterator iter = list.iterator(); iter.hasNext();) {
    System.out.print("write called");
    String[] nextLine = (String[]) iter.next();
    writeNext(nextLine);
    }

    there is some problem in " String[] nextLine = (String[]) iter.next(); "
    an error is displayed ..
    can any one plz hlp me out..

    Nida

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Even though you haven't told us what the error is, I can tell you now you should read Lesson: Generics (The Java Tutorials > Bonus)
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Java Code:
    Iterator it=list.iterator();
    while(it.hasNext()){
            String line=(String)it.next();
            writeNext(line);
    }
    it=null;

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 6
    Last Post: 04-09-2009, 02:11 AM
  2. Replies: 2
    Last Post: 04-07-2009, 06:25 AM
  3. Replies: 0
    Last Post: 02-11-2009, 09:53 AM
  4. [SOLVED] reader and writer on same file handle
    By Nicholas Jordan in forum Advanced Java
    Replies: 11
    Last Post: 07-01-2008, 03:39 AM
  5. Replies: 7
    Last Post: 05-23-2008, 03:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •