Thanks for the reply. I appreciate the desirability of thinking more OO
and less request/response. Even so, the Wicket Page class is still
modeling an html page. Where is the "onBeforeLoad" functionality of a
web page? Is "onBeforeRender" the equivalent?
With regard to the Login/Welcome example, I have a problem with the
Login's page's mutator methods being called in the onClick() in the
Welcome page. Your scenario requires that Welcome know too much about
Login. If Welcome and Login depend on the same model, and Welcome
changes the model, then when control is passed back to Login it should
be able to act on that change without the need for Welcome to know about
it. I don't see yet where Login has the opportunity to act on the model
change before the page is displayed. Again, is this where
onBeforeRender() comes in? Or some other method?
Thanks, again, Will
Ryan Holmes wrote:
I think one of the keys to getting comfortable with Wicket is to think
in terms of plain objects rather than requests, pages, etc. For
example, if you were working with a Person object rather than a Login
page and you wanted to provide some way of modifying that Person
object, you would just add a mutator method to the Person class,
right? Well, it's the same thing in Wicket. Just add a method to the
Login page class that performs whatever modifications you want. This
method might update the models for components on that page, change the
visibility of components, replace components with other components,
just to name a few possibilities.
In the example you gave, this method (the Login page's mutator method)
would be called from the onClick() method in the Welcome page's Link,
just before calling setResponsePage().
hth,
-Ryan
On Jul 27, 2007, at 11:20 AM, Will Jaynes wrote:
I'm new to Wicket and struggling a bit. I feel I may be stuck in old
thinking of action frameworks like Struts or Spring MVC.
All of the examples I have looked at so far do all the work of
creating and adding components for a page (or panel) in the
constructor of the page. Are there other places where this work can
be done? In a dynamic page, I can imagine that between the time a
page class is constructed and when the page is displayed, there might
be changes that have to be made. Where could this code be placed?
For example, the Pro Wicket book (around page 32) has an example of a
Login and a Welcome page. The Welcome page constructor takes a
reference to Login.this, so that a link back to the Login page takes
you back to the same instance of the Login page. In this scenario,
when the link is clicked and the response page is set to the existing
Login page, where is the opportunity to change the Login page, if
required? In Struts I would have the Struts action. Here, I'm not so
sure.
Thanks for any info.
Will
---------------------------------------------------------------------
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]