I'm a new Wicket using trying to figure out how to populate a form's
initial value with data from a bean (that is in the session already).
I've actually got it working, but I don't think I'm doing the best way.
public final class EmployeeMain extends BasePage {
    public EmployeeMain() {
        super ();
        Form employeeForm=new Form("employeeContactForm");
        Contact contact=getEmployeeSession().getEmployee().getEmpInfo();
employeeForm.setModel(new CompoundPropertyModel(contact));
        add(new TextField("firstName",new
Model(contact.getFirstName())));
        add(new TextField("lastName"));

    }

My issue is with this line:
    add(new TextField("firstName",new Model(contact.getFirstName())));
Should I have to set the model even though I'm binding the form to a
bean has this property?
What is the correct way to handle setting the initial form value from a
bean?

Thanks,

David

********************************************
Keep it Green! To help protect the environment, please
only print this email if necessary. 
Printing email can cost more than you think. 
Learn more on our website: http://www.hermitagelighting.com/printing_email.php

The information transmitted in this email is 
intended solely for the individual or entity 
to which it is addressed and may contain 
confidential and/or privileged material. 
Any review, retransmission, dissemination or
other use of or taking action in reliance 
upon this information by persons or entities 
other than the intended recipient is prohibited. 
If you have received this email in error please 
immediately notify us by reply email to the sender. 
You must destroy the original material and its contents from any computer. 
******************************************** 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to