Hi cleverpig,

You can use @SetupRender or onActivation methods to setup ur page.
There was a long discussion in the mail list about when to use what.

Using the @setuprender on ur page would be as simple as:


        @SetupRender
        private void loadData() {
           this.data=serv.list();
        }

2009/9/25 cleverpig <greatclever...@gmail.com>:
> hi,friends!
>
> i got a trouble thing:how to do initialization work when custom
> component was called?
> i mean when i made a custom component which need some parameters,and
> these parameters will be inject in the page that the custom component
> hold on.
>
> such as:
> the custom component class:
> public class DictionarySelect  extends AbstractField
> {
> ...
>        @Parameter(required=true)
>        private List data;
> ...
> }
> the page class:
> public class MyPage{
>        @InjectService
>        private DictionaryService serv;
>        private List data;
>        void onPageLoaded(){
>            data=serv.list();
>        }
> ...
> }
> the tml code:
> <html t:type="layout"
>        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>        <t:DictionarySelect  t:data="dataFromServ"/>
> </html>
>
> notes:
> the injected serv will load the data variable of DictionarySelect Component.
> When this page is first instantiated,i would call serv's list method
> to assign a list to data variable.
> but i got null exception...
>
> what's the way to prepare data for component which get data from
> page's parameter that depend on inject service?
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liu...@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> or...@facebook: http://www.facebook.com/group.php?gid=8159558294
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to