You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borut Bolčina <bo...@gmail.com> on 2007/10/22 22:26:46 UTC

T5: Injecting initialized array

Hi,

one of my pages needs to have an ArrayList of strings. This array must be
populated once per application start. The array gets populated by reading a
file line by line.

How is this done the T5 (and Tapestry IoC) way? I am looking for the most
elegant solution.

Cheers,
Borut (T5 newbie)

Re: T5: Injecting initialized array

Posted by Josh Canfield <jo...@thedailytube.com>.
Hi Borut,

If this is really just for one page then you may just want to use a static
initilializer in your class, and a static property to hold it.

Or you could build a service
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html. Use the
singleton service scope so it only gets built once.

There are lots of examples of creating a service between this list, the wiki
and the documentation.

Josh


On 10/22/07, Borut Bolčina <bo...@gmail.com> wrote:
>
> Hi,
>
> one of my pages needs to have an ArrayList of strings. This array must be
> populated once per application start. The array gets populated by reading
> a
> file line by line.
>
> How is this done the T5 (and Tapestry IoC) way? I am looking for the most
> elegant solution.
>
> Cheers,
> Borut (T5 newbie)
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.