PasswordTextField passwordField1 = new PasswordTextField("password");
  PasswordTextField passwordField2 = new
PasswordTextField("controlPassword");
on these lines you are creating components with null model, and on wicket
models can be inherited from components higher in the hierarchy. I think in
your case, these components have an parent component with an
IComponentInheritedModel, probably an CompoundPropertyModel. You can't pass
an new Model() to these PasswordTextField and will not get this exception...



On Thu, Sep 10, 2009 at 1:21 PM, <[email protected]> wrote:

>  I have the below snippet of code used to allow the user to change their
> password by typing their old password and then typing in their new password
> twice. Not sure why but I'm getting the following exception when the code is
> executed:
>
> WicketMessage: No get method defined for class: class
> org.cityofchicago.dor.ezdec.domain.security.EzdecUser expression:
> controlPassword
>
> Things were working fine until I moved the password stuff to the
> WebMarkupContainer.
>
> Any suggestions would be greatly appreciated.
>
> PasswordTextField oldPasswordField = new PasswordTextField("oldPassword",
> new Model()) {
>             @Override
>             public void validate() {
>                 if
> (!MD5Helper.toMD5(getInput()).equals(EzdecSession.getCurrentUser().getPassword()))
> {
>                     error(new IValidationError() {
>                         @Override
>                         public String getErrorMessage(IErrorMessageSource
> arg0) {
>                             return "Old password does not match password on
> file. Please ensure caps lock is not on and try again.";
>                         }
>                     });
>                 }
>             }
>         };
> //        form.add(oldPasswordField);
>
>         PasswordTextField passwordField1 = new
> PasswordTextField("password");
>         passwordField1.add(StringValidator.lengthBetween(6, 50));
> //        form.add(passwordField1);
>
>         PasswordTextField passwordField2 = new
> PasswordTextField("controlPassword");
>         passwordField2.setModel(passwordField1.getModel());
>         passwordField2.setResetPassword(false);
> //        form.add(passwordField2);
>
>         form.add(new EqualPasswordInputValidator(passwordField1,
> passwordField2));
>
>         WebMarkupContainer passwordWmc = new
> WebMarkupContainer("passwordWmc") {
>
>             @Override
>             public boolean isVisible() {
>                 if ((!EzdecSession.getCurrentUser().equals(user)) &&
> (EzdecSession.getCurrentUser().isAnyAdministratorUser())) {
>                     return false;
>                 } else {
>                     return true;
>                 }
>             }
>
>         };
>
>         passwordWmc.add(oldPasswordField);
>         passwordWmc.add(passwordField1);
>         passwordWmc.add(passwordField2);
>
>         form.add(passwordWmc);
>

Reply via email to