On 9/15/06, Scott Lusebrink <[EMAIL PROTECTED]> wrote:
> I need a place where i can initialize a page, get data from the database and
> set the models of my components.  I assume I'm going to need the data before
> i set the models.

The models and the actual data they link to are different things.
Wicket models are in fact locators for that data, and they will only
be accessed (and attached if they are attachable) when needed.

> I know some components constructors require models to be
> passed in and can not be set later.

Most default components do not though. Which ones are you referring
to? Anyway, it doesn't matter much, as setting the model right on
construction (either by passing into to the constructor using
setModel) is the best practice. But you don't have to have the actual
data yet.

>  The problem with doing this work in the
> constructor is that when I"m making links to this page from somewhere else
> it will run all this database work when your on the page that links to it.
> (This really slows things down, i don't want to go to the DB until they
> click the link)

Why would you even create the page while you're actually linking to
it? E.g, when you do (2.0 code):

new Link(this, "link") {
  onClick() {
    setResponsePage(new MyPage());
  }
}

MyPage will only be constructed when the link is clicked. Furthermore,
look at PageLink and BookmarkablePageLink.

Read more about models here:
http://www.wicket-wiki.org.uk/wiki/index.php/Models or here
http://www.apress.com/book/bookDisplay.html?bID=10189 and take a look
at the wicket-examples project.

Eelco

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to