Re: retrieving a list of file name in popup button

"Cheong Hee (Datasonic)" <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <005a01c6c047$01eb80e0$0302a8c0@CHNGXP>
program error at getAllfiles() & see the following::


         if (files.length > 0)
             fileArray = new NSMutableArray(files);
         else
             fileArray = new NSMutableArray();
         //for (int i = 0; i < files.length; i++) {
        //fileArray =new NSMutableArray(files[i]);
         //}

Sorry for the confusion as there is no index in the binding, mistaken as 
WORepetition.

Cheers

Cheong Hee

----- Original Message ----- 
From: "Cheong Hee (Datasonic)" <[email protected]>
To: <[email protected]>; "Yamuna Vallipuram" 
<[email protected]>
Sent: Monday, August 14, 2006 10:31 AM
Subject: Re: 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" <[email protected]>
> To: <[email protected]>
> 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
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>>
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.