Here you make a small mistake.

The properties of the Book are not added to the page. It is a Label component that /renders/ its bound model. In this case the model references the title of the book.

The Wicket id has nothing to do with business object properties.

The corresponding Java code is the following:

add(new Label("title", new PropertyModel(book, "title")));

that we use title for both the component ID and the property has merely meaning for us humans. Wicket doesn't recognize it magically.

There is an exception to this rule: shared models like CompoundPropertyModel and BoundCompoundPropertyModel. These specific models allow a control to share its model with its child components.

You can read more information concerning this on the Wiki (Working with Models) and on my blog (http://www.jroller.com/page/dashorst).

Martijn




Nick Heudecker wrote:

From reading the Library example, I've seen that the Book object is
never added to the page, but properties of the book object are: title,
type, etc.  Why not just add the Book instance to the page and refer
to it directly in the markup?

Instead of:
<span wicket:id="title"/>

Have:
<span wicket:id="book.title"/>

Or is this already possible and I just missed it?


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to