Peter Muir of the Seam team has written up an introduction into using Wicket and Seam together.
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.
Doesn’t have this page a serialization problem? If it is serialized won’t the SEAM objects be serialized copies from the SEAM contextual objects?
Comment by Cruz — May 8, 2009 @ 5:24 pm