I wrote the following code with Forms and Models... is there a more compact way of doing this? Would it be a bad idea to combine the form class and the model class into one and have it reference itself as a Model object?
Also, since I am not so concerned about holding on to the model's state (logins are usually just one-time requests and the form is always reset on failure), what's a simple way of doing this without storing the LoginModel in the session? Thanks in advance! -------------------- public class Login extends BasePage { // TODO Add any page properties or variables here public Login () { super ("Login"); add (new LoginForm ("loginForm")) ; } } class LoginForm { LoginModel loginModel = null ; public LoginForm (final String componentName) { super (componentName) ; loginModel = new LoginModel () ; this.setModel (new CompoundPropertyModel (loginModel)) ; add (new RequiredTextField ("loginName")); add (new PasswordTextField ("password")); } public void onSubmit () { String loginName = loginModel.getLoginName () ; if ("asdfasdf".equals (loginModel.getPassword ())) { MySession session = .... session.setLoginName (loginName) ; this.setResponsePage (Home.class) ; } else { log.warn ("Login failure for " + loginName) ; this.setResponsePage (getPage ()) ; } } } class LoginModel implements Serializable { private String loginName ; private String password ; public String getLoginName () { return loginName; } public void setLoginName (String loginName) { this.loginName = loginName; } public String getPassword () { return password; } public void setPassword (String password) { this.password = password; } } -- View this message in context: http://www.nabble.com/Forms-Models-tf2341262.html#a6516020 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user