I have would like to edit an existing user's properties including the
password. However, all the other properties are appearing on their
corresponding fields except the password field. How do i make it appear?.
here is my component for editing users
public class UserPanel extends Panel {
/**
*
*/
private static final long serialVersionUID = 3819937222116190372L;
@Inject
private UserDao userDao;
private TextField<String> txtUsername;
private PasswordTextField txtPassword;
private PasswordTextField txtConfPassword;
private User user;
public UserPanel(String id, final User user) {
super(id);
this.user = user;
Form<User> frmCreateUser = new Form<User>("frmCreateUser") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit() {
if (user.getId() == null) {
Long id = userDao.saveUser(this.getModelObject());
info("User #" + id + " has been created");
} else {
Long id = userDao.updateUser(this.getModelObject());
info("User #" + id + " has been updated");
}
}
};
frmCreateUser.setModel(new Model<User>(user));
add(frmCreateUser);
txtUsername = new TextField<String>("txtUsername",
new PropertyModel<String>(user, "username"));
txtPassword = new PasswordTextField("txtPassword",
new PropertyModel<String>(user, "password"));
txtConfPassword = new PasswordTextField("txtConfPassword",
new PropertyModel<String>(user, "password"));
frmCreateUser.add(txtUsername);
frmCreateUser.add(txtPassword);
frmCreateUser.add(txtConfPassword);
}
the txtPassword and txtConfPassword fields display empty and so i have to
provide a password every time i edit the user.
Kindly help
Regards
Josh