> private Employee e;
[...]
> public LoginForm(final String id) {
> super(id);
> setModel(new CompoundPropertyModel(e));
Notice that your model is null.
Regards,
Carlos
On 9/10/07, Cristina <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm trying to set up a simple login page where the password is retrieved
> from the DB if the username exists. The page is rendered as it should but I
> get a *WicketMessage: Null object setting value: bsouza with expression:
> login* when I enter a valid login (bsouza) and his password.
>
> Since the code is quite short I'll reproduce it below:
>
> public class LoginPage extends JDJStaticPage {
>
> private Employee e;
> private TextField login;
> private PasswordTextField pword;
>
> public LoginPage() {
> add(new FeedbackPanel("feedback"));
> add(new LoginForm("form"));
> }
>
> private class LoginForm extends Form {
>
> public LoginForm(final String id) {
> super(id);
> setModel(new CompoundPropertyModel(e));
> add(login = new TextField("login"));
> add(pword = new PasswordTextField("pword"));
> login.setRequired(true);
> }
>
> protected void onSubmit() {
> e = (Employee) SERVICE.findEmployeeByLogin(userLogin());
> if (e != null) {
> // login is valid...
> if (userPword().equalsIgnoreCase(e.getPword())) {
> // password is correct...
> // setResponsePage(Home.class); // doesn't exist yet...
> }
> } else {
> error("Unable to sign you in."); // shows up in
> FeedbackPanel?
> }
> }
>
> private String userLogin() {
> return (login.getModelObjectAsString());
> }
>
> private String userPword() {
> return(pword.getModelObjectAsString());
> }
> }
> }
>
> Thanks for your help,
>
> Cristina
>
> --
> View this message in context:
> http://www.nabble.com/Setting-up-a-very-simple-login-page-tf4419382.html#a12605286
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]