you can make those objects initialize lazily by either using models
that load data lazily or doing the initialization in onbeforerender()

-igor


On Fri, May 9, 2008 at 4:07 AM, Joel Halbert <[EMAIL PROTECTED]> wrote:
> Hi Igor,
>
> Yes I take your point about being able to replace components within the
> onSubmit, that's certainly a good option in some cases.
>
> However - in the scenario that I'm looking there are components in the page
> that initialise themselves dynamically from a database model. What's
> happening  now is that they initialise themselves once when the page and
> components are first created (some default arrangement say) and then during
> the onSubmit they need to be set up again, based on the values submitted in
> the form. This then means that the database is accessed twice, and not once,
> and I'm trying to avoid multiple database access.
>
> (actually to get around this for the time being I'm not using the forms
> onSubmit() to access the form values, instead I'm reading directly off the
> PageParameters object when the page is first created, which avoids the dual
> load issue described above, but it seems like a bit of a hack as I don't
> feel I'm leveraging the framework correctly)
>
> Cheers,
> Joel
>
> --------------------------------------------------
> From: "Igor Vaynberg" <[EMAIL PROTECTED]>
> Sent: Friday, May 09, 2008 3:03 AM
> To: <users@wicket.apache.org>
> Subject: Re: Form onSubmit called after Page components created
>
>> the stateless stuff has to recreate the component hierarchy first - eg
>> the form instance has to exist before you can call onsubmit on it :)
>>
>> however, inside onsubmit you can do any component replacement you
>> want, just like in a non-stateless page.
>>
>> -igor
>>
>>
>> On Thu, May 8, 2008 at 4:36 PM, Joel Halbert <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi,
>>>
>>>  I've noticed that when submitting a (stateless) Form page the onSubmit()
>>> method of the form is only called once all the Page components have all been
>>> created, and likewise any model objects relating to the form are only
>>> populated once the page components have been rendered.
>>>
>>>  This means that it is hard to create dynamic content in the page that is
>>> dependent on the contents of the submitted form without "reloading the page"
>>> using
>>>  setResponsePage(MyPage.class, pageParams) at the end of the onSubmit()
>>> call of the form.
>>>
>>>  Has anyone else noticed this and is there a way around it? i.e. can the
>>> models be populated before the page components are created?
>>>
>>>  Rgs
>>>  Joel
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to