Calling setResponsePage(Page a) increases your session size by the size of a
serialized version of 'a'.  If 'a' has a List of data that 'a' is going to
display, that size may be non-trivial.  As long as you're okay with that,
it's fine... but I wouldn't recommend doing that unless there's a good
reason.  I do this in some cases with wizards as you're filling 'SomeObject'
with data throughout the wizard steps, and then at the end commiting it to
the database.  But again, understand that this is using a lot more memory
than keeping the data outside the page.  It's a trade off based on the
situation.

Passing a Page instance to the constructor of another Page doesn't sound
right to me.  Again, it depends on what you're trying to do, but I haven't
seen many instances where passing an instance of 'Page a' versus an IModel
with the data 'Page a' is displaying is the 'right' thing to do (in my
opinion).

So basically if it's worth it for you to grow the session size on the app
server to avoid the overhead of re-querying it from the database, go
crazy... but I don't think the UI framework is the best place to handle data
caching.



Serkan Camurcuoglu-2 wrote:
> 
> Hi all,
> I'm quite new to Wicket and I'd like to ask whether what I'm doing is 
> right. Say I have two pages A and B. Page A loads a list of information 
> from the database and keeps it in an instance field. When a link on page 
> A is clicked, a new page B is created and page A passes itself as one of 
> the constructor arguments of B. Page B displays the information and 
> includes a link at the bottom saying "Back". When this link is clicked, 
> Page B calls setResponsePage() using the instance of Page A that was 
> passed in its constructor, and Page A is displayed again.
> 
> That way I believe that I avoid reloading the data from the database 
> again in Page A.
> 
> But I think somewhere in the mail archives I've read that it's 
> recommended to use setResponsePage(Class) instead of using 
> setResponsePage(Page). So I'm wondering whether I'm doing it right, and 
> if there is a better way I'd like to learn it.
> 
> Sorry if this is a dumb question but I want to be confident about what 
> I'm developing..
> 
> Regards,
> 
> SerkanC
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Best-practice-for-navigating-between-pages-tp18057162p18057871.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to