I don't think getters and setters are needed anymore.... it also support
field access.

On Thu, Apr 10, 2008 at 4:18 PM, Ryan Gravener <[EMAIL PROTECTED]>
wrote:

> Take a look at http://wicketstuff.org/wicket13/forminput/ and
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html
>
> In your login form I would have private member variables userId and
> password
>
> public class LoginForm extends Form {
>
> private String userId;
>
> private String password;
>
> public LoginForm(String id) {
> super(id);
> setModel(new CompoundPropertyModel(this));
> add(new TextField("userId"));
> add(new PasswordTextField("password"));
> }
>
> public void onSubmit() {
> System.out.println(userId);
> }
>
> //Make sure to add getters and setters
> }
>
>
>
> On 10/04/2008, Neo Anderson <[EMAIL PROTECTED]> wrote:
> > I follow the tutorial
> http://www.developer.com/java/web/article.php/10935_3673576_1 to learn how
> to use wicket. And I want to practise not to embed the Form inside another
> class. So I create a class called LoginForm.java and move the code to
> there
> (as follow).
> >  public class LoginForm extends Form {
> >   public LoginForm(String id) {
> >     super(id);
> >   }
> >   @Override
> >   public void onSubmit() {
> >         Object o = get("packageName.to.Login");
> >         System.out.println("object:"+o.getClass().getSimpleName());
> >         (Login (o)).getUserId();
> >         (Login (o)).getPassword();
> >
> >   }
> >  }
> >  However, after submit the form, I get the a NullPointerException error
> because the object o is null. How can I obtain the component of Login? Or
> how can I use the method of Login?
> >
> >  Thanks in advice,
> >
> >
> >
> >
> >       ___________________________________________________________
> >  Yahoo! For Good helps you make a difference
> >
> >  http://uk.promotions.yahoo.com/forgood/
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: [EMAIL PROTECTED]
> >  For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Ryan Gravener
> http://ryangravener.com
>

Reply via email to