Peter Muir of the Seam team has written up an introduction into using Wicket and Seam together.
</p>
He starts by stripping JSF support from the default Seam setup (and it never gets uncomfortable writing this down), and adding Wicket specifics to it. Peter starts with a simple Hello, World! page, which has nothing specific to Seam. But then things get interesting with implementing an authentication form using Seam's bijections.
The code is quite easy to follow (I've merged the final resulting form class, and applied a CompoundPropertyModel
to save on some code):
public class LoginForm extends Form {
@In Identity identity;
@In Credentials credentials;
public LoginForm(String id) {
super(id, new CompoundPropertyModel(credentials));
add(new TextField("username"));
add(new PasswordTextField("password"));
}
protected void onSubmit() {
try {
identity.authenticate();
setResponsePage(HomePage.class);
} catch (LoginException e) {
error("Login failed");
}
}
}
This looks very readable. Read more about Wicket and Seam on the Seam Blog.