PropertyModel not refreshing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PropertyModel not refreshing

Zeldor
Hi,

I have a form with labels that use PropertyModel. They work fine when I test them locally - when I click on submit button I get proper refreshed values in labels. But when I deploy my app it does not work, I still get old values. Where can be the problem? I am using Wicket 1.4.17 and deploying on Google AppEngine.

My code:

Form<String> buildHousesForm = new Form<String>("buildHousesForm", new Model<String>())
...
...
add(new Label("houses_amount",  new PropertyModel(MySession.get().getUser(), "village")));
...
...
Reply | Threaded
Open this post in threaded view
|

Re: PropertyModel not refreshing

Sven Meier
Hi,

you're probably holding on an outdated user object, use this instead:

  add(new Label("houses_amount",
      new AbstractReadOnlyModel<String>() {
        public String getObject() {
          return MySession.get().getUser().getVillage();
        }
      }));

Sven


On 10/06/2011 10:17 AM, Zeldor wrote:

> Hi,
>
> I have a form with labels that use PropertyModel. They work fine when I test
> them locally - when I click on submit button I get proper refreshed values
> in labels. But when I deploy my app it does not work, I still get old
> values. Where can be the problem? I am using Wicket 1.4.17 and deploying on
> Google AppEngine.
>
> My code:
>
> Form<String> buildHousesForm = new Form<String>("buildHousesForm", new
> Model<String>())
> ...
> ...
> add(new Label("houses_amount",  new PropertyModel(MySession.get().getUser(),
> "village")));
> ...
> ...
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-refreshing-tp3877389p3877389.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: PropertyModel not refreshing

Zeldor
Why would there be a difference between local and deployed versions?

And won't it negatively affect performance?
Reply | Threaded
Open this post in threaded view
|

Re: PropertyModel not refreshing

Sven Meier
Might have something to do with when the session is created and/or
serialized.

> And won't it negatively affect performance?

I'm not sure what you mean by "it", but the AbstractReadOnlyModel is
faster than a PropertyModel (no reflection involved).

HTH
Sven

On 10/06/2011 12:02 PM, Zeldor wrote:

> Why would there be a difference between local and deployed versions?
>
> And won't it negatively affect performance?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-refreshing-tp3877389p3877621.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: PropertyModel not refreshing

Zeldor
Thanks, I will give it a try :)