Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Iterate over a file list

Paul Benedict

2007-01-25

Replies:

Properties must begin with "get" -- which means "length" is not a
property. You will have to use scriptlets, or wrap your File in some
class which can expose a getter for you.

chuanjiang lo wrote:
> Hi all,
>
> I have an ArrayList (fileList) that stores the type java.io.File
>
> Im trying to iterate through the list to get the name and size of the file
>
>   <logic:iterate id="file" name="fileList" >
>     <bean:write name="file" property="name" />
>   </logic:iterate>
>
> java.io.File provides a method length() that return us the size of the
> file.
>
> So how i can get the size of the file?
> i tried <bean:write name="file" property="length" /> and the error prompts
> that there isnt a getter method for length.
>
> Any ideas?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.