I'd say because user.getState() returns null. Right?

On 9/12/06, Michael Wölm <[EMAIL PROTECTED]> wrote:

Hi,

Sadly, nobody have helped me with my problem. I dont know why. Am I too
noob
or is my question incomprehensible? I would be pleased, if anybody could
give me an advice for my problem.

Greettings from Germany,
Michael Wölm

Original message is under this.

-----Ursprüngliche Nachricht-----
Von: m-woelm [mailto:[EMAIL PROTECTED]
Gesendet: Sonntag, 10. September 2006 16:13
An: 'Tapestry users'
Betreff: Question: Can not get access to object fields (Null Pointer
Exception)

Hi,

I hope anybody could explain me why I get a Null Pointer Exception, if I
want to get access to a field of an object. My method is similar to the
eshop-project of the book "Enjoying web dev with Tapestry".

I tried to change the Listener-method onLogin as follows:


public void onLogin(IRequestCycle cycle) {

            try {

                  User user = Users.getKnownUsers
().getUser(email,password);

                  getUser().copyFrom(user);

                  if (user.getState().equals("admin"))
cycle.activate("Admin_Konsole");

                  else cycle.activate("User_Konsole");

            } catch (AuthenticationException e) {

                  ValidationDelegate delegate = getDelegate();

                  delegate.setFormComponent(null);

                  delegate.record("Login failed", null);

            }

      }



Now I get an exception at point (user.getState().equals("admin")).

But why? user was set to the login-user two lines before? Why I can't get
the field: private String state which I have set in User.class:


      private String state;

      public String getState() {

            return this.state;

      }


Thx ahead!

Michael Wölm



<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]

Public Key:  <http://gsg.ath.cx/~phoenix/downloads/MyPublicKey.asc>
href="http://gsg.ath.cx/~phoenix/downloads/MyPublicKey.asc







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Reply via email to