AW: WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread m-woelm
- Von: Steve Shucker [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 12. September 2006 16:03 An: Tapestry users Betreff: Re: WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help! As a general rule, it's safer to put the literal first in statements like

Re: WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread Steve Shucker
As a general rule, it's safer to put the literal first in statements like this: "admin".equals(user.getState()) If anyone wants to say that it looks/reads a bit funny, I'll agree. It's an odd syntax, but it protects you from NPEs. -Steve Martin Strand wrote: Well, if you get a NPE on this

Re: WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread Martin Strand
Well, if you get a NPE on this line: >> user.getState().equals("admin") then either "user" or "getState()" is null, right? And, since "user" is definitely not null, your private String "state" is obviously null. Perhaps you should add something like this: >> private String state = "initial state"

Re: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread Jesse Kuhnert
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.

WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread Michael Wölm
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