here is one of many wicket ways of doing it. notice that this way requires no component manipulation post creation. components push and pull data from your domain bean.

-Igor


class WicketTest2Form extends Form {
 
  private static class Bean {
    int op1; int op2; int result; //setters //getters
  }

  private final Bean bean=new Bean();
   
 public WicketTest2Form(String id) {
  
super(id,new CompoundPropertyModel(bean) );
    add(op1 = new TextField("op1"));
    add(op2 = new TextField("op2"));
...
    add(result = new Label("result");
...
 
protected void onSubmit() {
    int resultVal = calculator.calculate(
bean.getOp1(), bean.getOp2() , operation);
   bean.setResult(integer.toString(resultVal));  

  }


}

-Igor

Reply via email to