All,

Looking for some ideas/suggestions here (perhaps I am missing a trick here?).

Wicket binds html layout/styling to Java objects which define the component behaviour:

public class Home extends WebPage {

  @In Foo foo;

  public Home(final PageParameters parameters) {
    add(new LoginForm("login"));
  }
}

is doable, as we use a component instantiation callback (provided by Wicket) to make foo a proxy which asks Seam for the component *every time* the object is accessed. This is pretty ugly though, and I would prefer to use injection/disinjection.

However, if we want to do:

public class LoginForm extends Form {
    public LoginForm(String id) {
      super(id);
      add(new TextField("username", new PropertyModel(identity, "username")));
      add(new PasswordTextField("password", new PropertyModel(identity, "password")));
      }
      
      @Begin
      protected void onSubmit() {
        // Authenticate, and display feedback to user
      }
    }
  }
}

then no lifecycle callback will help.

As you can see the new operator is used almost exclusively. This means we can't use a proxy based interceptor system. So, AFAICS we have to use byte code enhancement to apply an interceptor, I guess either at compile time or through a custom classloader.

So,

1) is it worth it (this is starting to get very fiddly)?
2) is there a better way?

Thanks :)