You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kenixwong <ke...@yahoo.com> on 2007/09/26 14:01:19 UTC

retrieve a text file's content from C drive and display in table listing

hi, anybody have the idea...

my problem here is i want to retrieve few .txt file from one directory. And
all the content i store in the arraylist in order to display in table
structure. 

The transitional way, once u retrieve the content, normally we will insert
into database and then retrieve from database for displaying in html.

right now i wish to skip for insert into database. Mean once my program scan
the directory to get the .txt file's content and then direct display it as
table view. is taht possible to do in such way ?


for example: 
txt content 

a.txt
-----
title = abc
Ipaddress = 192.122.0.331
user = alex


b.txt
-----
title = 123
Ipaddress = 192.122.0.3313
user = mary

a.txt
-----
title = fgd
Ipaddress = 192.122.0.344
user = kent


table view (html)

filename | title  | Ipaddress        | user
---------------------------------------
 a.txt     | abc  | 192.122.0.331 | alex
 b.txt     | 123  | 192.122.0.333 | mary
 c.txt     | fgd   | 192.122.0.344 | kent





-- 
View this message in context: http://www.nabble.com/retrieve-a-text-file%27s-content-from-C-drive-and-display-in-table-listing-tf4521905.html#a12899446
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: retrieve a text file's content from C drive and display in table listing

Posted by Swaroop Belur <sw...@gmail.com>.
Hi

If u see the interface IDataProvider , it is my no means explicitly
coupled to the database. Basically all it expects u to do is implement
it in such a way so it that what is the result for the current page
and what kind of model you want to store the data in session .
i.e in model(Object) method .

So basically just implement ur own logic to get the result, if u r
paginating,
for that page as u wud do with database query.

Size - just the number of files in directory.

model - some object so that u can get back the details for the file e.g for
a.txt
...Typically one would store a primary key as a field in ur custom
detachable model.
You can store filename here..so that u can re create the row details.

class myobject {

String filename;
String title;
String ipaddress;
String user;

// get  methods
// set methods
}


class mymodel extends loadabledetachablemodel{

String filename;

mymodel(){
  super(myobject);
  this.filename = myibject.filename;
}
object load(){
//   build ur  myobject here
}


}


On 9/26/07, kenixwong <ke...@yahoo.com> wrote:
>
>
> hi, anybody have the idea...
>
> my problem here is i want to retrieve few .txt file from one directory.
> And
> all the content i store in the arraylist in order to display in table
> structure.
>
> The transitional way, once u retrieve the content, normally we will insert
> into database and then retrieve from database for displaying in html.
>
> right now i wish to skip for insert into database. Mean once my program
> scan
> the directory to get the .txt file's content and then direct display it as
> table view. is taht possible to do in such way ?
>
>
> for example:
> txt content
>
> a.txt
> -----
> title = abc
> Ipaddress = 192.122.0.331
> user = alex
>
>
> b.txt
> -----
> title = 123
> Ipaddress = 192.122.0.3313
> user = mary
>
> a.txt
> -----
> title = fgd
> Ipaddress = 192.122.0.344
> user = kent
>
>
> table view (html)
>
> filename | title  | Ipaddress        | user
> ---------------------------------------
> a.txt     | abc  | 192.122.0.331 | alex
> b.txt     | 123  | 192.122.0.333 | mary
> c.txt     | fgd   | 192.122.0.344 | kent
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/retrieve-a-text-file%27s-content-from-C-drive-and-display-in-table-listing-tf4521905.html#a12899446
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>