Hi Sebastian,

thanks - but if the page has many subcomponents that consume the model then 
there would be many subsequent calls? The service call might be expensive, 
isn’t it?
Is there another solution next to loadable detachable model? I could use a 
static model if the model does not change during a request…

You said that the #getObject should not be overridden in this way:
When to recommend it? The example below uses this approach:

personForm.add(new RequiredTextField("personName", new Model() {
    @Override
    public Object getObject() {
        return person.getName();
    }
 
    @Override
    public void setObject(Serializable object) {
        person.setName((String) object);
    }
}));

Thanks, Chris

> Am 22.04.2015 um 23:16 schrieb Sebastien <seb...@gmail.com>:
> 
> Hi Chris,
> 
> #getObject is potentially called often, yes. You should never override
> #getObject() like this....
> A dynamic model is a LoadableDetachableModel. Overrides #load and it will
> be called only once by server request, at each server request (that
> consumes the model, of course).
> 
> Hope this helps,
> Sebastien.
> 
> 
> On Wed, Apr 22, 2015 at 11:05 PM, Chris <chris...@gmx.at> wrote:
> 
>> Martin, thanks for the tip.
>> 
>> I would like to use some dynamic List Model, but not a detachable one and
>> put following in the page’s initialization method:
>> 
>>  IModel<List<SomeType>> poisModel = new ListModel<SomeType>() {
>>            @Override
>>            public List<SomeType> getObject() {
>>                return service.retrieveList();
>>            }
>> 
>> Why is the service.retrieveList method called so often, I thought that
>> this call should be only made once?
>> Should I use another model?
>> 
>> Thanks!
>> Chris
>> 
>> 
>>> Am 22.04.2015 um 07:58 schrieb Martin Grigorov <mgrigo...@apache.org>:
>>> 
>>> Hi,
>>> 
>>> Wicket disables caching for the pages [1] so going back will make a
>> request
>>> for re-render.
>>> You should use dynamic models [2] to re-render the latest state.
>>> 
>>> 
>>> 1.
>>> 
>> https://github.com/apache/wicket/blob/822a1693c2d017478613321ae6fce40d519b24fa/wicket-core/src/main/java/org/apache/wicket/markup/html/WebPage.java#L205
>>> 2.
>>> 
>> https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models#WorkingwithWicketmodels-DynamicModels
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> On Wed, Apr 22, 2015 at 5:48 AM, Chris <chris...@gmx.at> wrote:
>>> 
>>>> Hi all,
>>>> 
>>>> how is it possible to refresh a page or panel on browser back? If the
>> user
>>>> deletes an item and clicks on browser back to go to the last page, it is
>>>> still displayed which should not be the case.
>>>> 
>>>> Thanks a lot,
>>>> Chris
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 

Reply via email to