Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
 
public class CrudPage extends Page {

    // Adds the control to the page
    @Bindable("control"BindingType.CONTROL) 
    private Form form = new Form();

    // Adds the control to the page
    @Bindable("control"BindingType.CONTROL) 
    private Table table = new Table();

    // Adds the value to the page model before the page template is rendered
    @Bindable("model"BindingType.MODEL)
    private String pageTitle;

    // Binds the request value "customerId" to this method performing type conversion
    @Bindable("request"BindingType.REQUEST)
    public void setCustomerId(Integer id) {
        CustomerDao customerDao = DaoFactory.getCustomerDao();
        Customer customer = customerDao.getCustomerForPK(id);
        form.copyFrom(customer);
    }

}

Thanks Fredrik Jonson for the BindingType enum suggestion.