[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

retrieving a list of file name in popup button



You probably need to add this in your getFilename() method:

     filename = (String) ((File)fileList.objectAtIndex(index)).getName();

where "fileList" is the attribute of mutable array that you need to set in
getAllFiles;
and "index" is the local attribute int that you need to bind in your pop-up
button "index".

It looked that is no connection between list binding and stringDisplay
getFilename in your pop-up button.

Cheers

Cheong Hee


----- Original Message ----- 
From: "Yamuna Vallipuram" <yamuna.vallipuram@xxxxxxxxxxx>
To: <webobjects-dev@xxxxxxxxxxxxx>
Sent: Sunday, August 13, 2006 8:46 PM
Subject: retrieving a list of file name in popup button


> Hi...
> 
> I am quite new to WebObject so I have a question retrieving file  
> names from a path and displaying them in a popup button,
> 
> my popup button list binding is getAllfiles
> and stringDispaly is getFilename
> 
> When I try run the project I get en error message  at  
> PersonImport1.getAllefiler(PersonImport1.java:122)-  
> NullPointerException. My codes returns the correct directory path,  
> but I am unable to retrieve the files. What am I doing wrong here...
> 
> 
> public NSMutableArray getAllfiles() {
>     if (downloadDir.exists() == false) {
>     downloadFeilmelding= "directory not found!";
>     } else {
>          File files[] = downloadDir.listFiles();
>          for (int i = 0; i < files.length; i++) {
>         fileArray =new NSMutableArray(files[i]);
>          }
>     }
>     return fileArray;
>     }
> 
>     public String getFilename() {
>     String tmp;
>     tmp = enFil.getName();
>     return tmp;
>     }
> 
> Any help will be appreciated
> regards Yamuna
> _______________________________________________
> WebObjects-dev mailing list
> WebObjects-dev@xxxxxxxxxxxxx
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>