Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2009, 09:23 AM
Member
 
Join Date: Mar 2009
Posts: 14
Rep Power: 0
nida is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 05-07-2009, 03:20 PM
OrangeDog's Avatar
Senior Member
 
Join Date: Jan 2009
Location: Cambridge, UK
Posts: 838
Rep Power: 2
OrangeDog is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-08-2009, 08:04 AM
serjant's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Ukraine,Zaporozhye
Posts: 486
Rep Power: 2
serjant is on a distinguished road
Send a message via ICQ to serjant Send a message via Skype™ to serjant
Default
Code:
Iterator it=list.iterator();
while(it.hasNext()){
        String line=(String)it.next();
        writeNext(line);
}
it=null;
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-08-2009, 03:08 PM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,483
Rep Power: 8
Fubarable is on a distinguished road
Default
Moderator action: spam post from Bubbalekh deleted
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to refresh a text file after printing using Print writer rameshkondur AWT / Swing 6 04-09-2009 03:11 AM
File fp = new File(filePath);fp.exists() does not yeild proper result ganeshp Advanced Java 2 04-07-2009 07:25 AM
how to read openproj(Projity) file i.e. ,POD file(Project Management file) mahendra.athneria New To Java 0 02-11-2009 10:53 AM
[SOLVED] reader and writer on same file handle Nicholas Jordan Advanced Java 11 07-01-2008 04:39 AM
How to parse the CSV(Comma separation values)file and validate the file using java padmajap13 Advanced Java 7 05-23-2008 04:46 AM


All times are GMT +2. The time now is 09:14 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org