On 7/25/07, Will Jaynes <[EMAIL PROTECTED]> wrote: > Using 1.3beta2. > I'm new, so maybe I shouldn't be trying to work with the Wizard stuff > from wicket-extentions this early, but... > > I just don't see how to get at my model in between steps, or rather, at > the end of a step. My wizard constructor looks like: > public class RequestWizard extends Wizard > { > public RequestWizard(String id) > { > super(id); > ConsultRequestBackingBean backingBean = new > ConsultRequestBackingBean(); > setModel(new CompoundPropertyModel(backingBean)); > WizardModel model = new WizardModel(); > model.add(new RegNumberStep()); > model.add(new RequestTypeStep()); > init(model); > } > ... > > In my RegNumberStep class, when the "Next" button is pressed, I > understand that the applyState() method is called. In that method I > would like to get a hold of my ConsultRequestBackingBean. But if I call > getModelObject() I get an exception > > No get method defined for class: class > edu.umich.med.wcp.wicket.model.ConsultRequestBackingBean expression: view > > I'm afraid I don't understand why Wicket is attempting to call getView() > on my ConsultRequestBackingBean.
That is because on the wizard component you define a CompoundPropertyModel, and you ask the model of a wizardstep (RegNumberStep), which is a *child* of that wizard (a direct child, with id 'view'). As RegNumberStep does not have an explicit model set itself, it will use the parent's CompoundPropertyModel to get the model value, but with it's own id as a property expression. In the same fashion: setModel(new CompoundPropertyModel(person)); add(new TextField("name")); will have the effect that the textfield works on property name of person. A solution is to do this instead: findParent(Wizard.class).getModelObject() Or... you could expliciltly pass in references to the model object. The NewUserWizard for example does this (see the user var/ getUser method). If you don't want to use nested classes like that, you'd have to explicitly pass the person object or expose it in another way. Hope that helped, Eelco ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions. _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user