what version of wicket are you using?

when i run your example i get:

Login Constructor called!
User id was asdadasda and the password was asdasdasd
Welcome Constructor!

which is the output i would expect.

-Igor



On 12/20/05, karthik Guru <[EMAIL PROTECTED]> wrote:
Hi Igor,
 
this is the code..
 
#Login page
 
public class Login extends WebPage {
 private TextField userIdField;
 private PasswordTextField passField;

 public Login(){
  System.out.println("Login Constructor called!\n\n");
  Form form = new Form("loginForm"){
   
   public void onSubmit(){
    
    String userId = Login.this.getUserId ();
    String password = Login.this.getPassword();      
    System.out.println("User id was "+  userId +
      " and the password was " + password);
    Welcome welcomePage = new Welcome();
    Component c = welcomePage.get("message");
    c.setModel(new Model("Welcome To Wicket Mr " + userId));
    setResponsePage(welcomePage);
   }
  };
  userIdField = new TextField("userId", new Model(""));
  passField = new PasswordTextField("password",new Model(""));
  passField.setResetPassword(false);
  form.add(userIdField);   
  form.add(passField);
  add(form);
 }
 protected String getUserId() {
  return userIdField.getModelObjectAsString();
   
 }
 protected String getPassword() {
  return passField.getModelObjectAsString();   
 }
}
 
 
/*** Welcome.java **/
 
public class Welcome extends WebPage {
 public Welcome(){
  System.out.println("Welcome Constructor!\n\n");
  IModel model = new Model("");
  add(new Label("message",model));
 }
}
 
 
/** Welcome.html **/
 
<html>
  <title>Welcome to Wicket Application</title>
  <body>
    <span wicket:id="message">Message goes here</span>
    <wicket:link>
     <a href = "" Login.html">Login</a><br/>;
    </wicket:link>
  </body>
</html>
 
 
And on the console
 

Login Constructor called!


User id was karthik and the password was password
Welcome Constructor!


Login Constructor called!

 

Reply via email to