This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I get a null pointer exception at the line marked **. The "sessionBean" attribute is not initialised at first, but shouldn't the expression just put null into sB without giving an exception? What is a better approach? Thanks, M
Joined: Aug 09, 2005
Sorry, I think I have the wrong line for the exception - time to dig around in Tomcat...
The only way that line can throw a NullPointerException is when session is null. How do you get the session? If you have created it using request.getSession(false), and if a session does not already exist, it won't create a session and the 'session' object will be null.