On Friday 16 September 2005 18:29, Tomáš Drenčák wrote:
> Thanks a lot.
>
> Another question... You are using pageValidate to set up thisPerson
> property. I'm still little bit confused about page initialization.
> What are pageBeginRender, pageValidate and prepareForRender for? Where
> to initialize e.g. thisPerson from passed personId parameter? I've
> used pageBeginRender, lazy initialization, but which method is
> specially designed for this purpose?


I must admit, this was a bit trial and error.  

I pass the personId parameter via the following code in another component.


        @InjectPage("Details") 
        public abstract Details getDetailsPage(); 
         
        public IPage doShowDetails(int personId) { 
            Details details = getDetailsPage(); 
            details.setPersonId(personId); 
            return details; 
        } 
}

Where this code gets set up in the html template for this component as

<div class="surname">
        <span jwcid="@DirectLink"
                listener="listener:doShowDetails"
                parameters="ognl:person.id"
                ><span jwcid="@Insert"
                        value="ognl:person.surname"
                        >Chandler</span></span>
</div>


I think PageBeginRender failed  (thinking back to when I orginally had it 
here) because there seems to be a validation phase of the page before then, 
and I had not set up the record, and had null pointer exceptions.

I think the page initialisation failed because the setPersonId call hadn't 
happened (maybe - difficult to remember now) the initialisation got called 
when I did the first call to getDetailsPage in the listener above.

-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to