and if a user just refreshes the page? or you use it as a response
page somewhere else? then suddenly everything is empty?


If the user refreshes the page the previous request parameters will be
reposted and will overwrite the fresh form model object properties, so he
will see the page as was before his last non-submitted changes. That seems
fine to me. What I'm not sure is about what will happen if the first page
(the one previous to any submission) is reloaded. Will wicket reinstantiate
the form so the contents will be correctly reloaded from the repository? Or
will it reuse the form stored in the session whose model will now return a
blank object?

Cheers,
Carlos




On 3/29/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > One problem I have due to avoiding DTOs is that most of the time I
don't
> > want to serialize my form models, because they are (often big)
entities
> with
> > lazy loaded associations. So in principle I would use an
> > LoadableDetachableModel to load the entity from the repository each
time
> the
> > model is reattached. But suppose I'm updating a UserProfile. The first
> time
> > it would be ok to populate the model from the persistent profile to be
> > updated. But once the form is submitted there's no point in loading
the
> > profile from the repository again because its properties would be
> > overwritten from those coming from the form anyway. So I'm tempted to
> > subclass AbstractDetachableModel so that it loads the profile from the
> > repository upon creation, but instantiates a brand new profile to be
> > populated from the form upon reattachment. Is there a better pattern
for
> > this? Anyone has run into the same problem?
>
> Sounds like that could work. Btw, you can still just use
> LoadableDetachableModels. Something like this?
>
> class SomeModel extends LoadableDetachableModel {
>
>   protected Object load() {
>     return new Foo();
>   }
> }
>
> new SomeModel(anotherFooThatWasLoaded);
>
> The thing I want to point out here is that you can just initialize the
> LDM with the object you loaded from the database, for the first
> request, and then implement load like this to get fresh instances on
> next requests.
>
> Eelco
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to