Unknown cause of NullPointerException in JSP

I am just trying to base a conditional statement on the result of a method call that returns a String value. I seem to get a NullPointerException while checking for the exception. Anyone have any ideas? Here is the section of code: <% String s = item.getOrderNumber(); %> <% if(s != null) { %> Some HTML here <% } else { %> Some other HTML here <% } %> I'm not exactly sure where the NullPointerException is occuring in this, but when I remove this things get generated fine.

For verification on the "item" not being null, the following code works fine. <TD><A HREF="javascript:submitDoc('DisplayDocs','ts=<%=Globals.URLEncode(item.getTimeStamp())%>&order=<%=item.getOrderNumber()%>&doctype=ack');">Acknowledgement</A>&l t;/TD> The generated result is: <TD><A HREF="javascript:submitDoc('DisplayDocs','ts=2001-09-19-09.02.54.444173&order=null&doctype=ack');">Acknowledgement</A></TD> I replace with this to catch the null. <% String s = item.getOrderNumber(); %> <TR> <% if(s != null) { %> <TD><A HREF="javascript:submitDoc('DisplayDocs','ts=<%=Globals.URLEncode(item.getTimeStamp())%>&order=<%=item.getOrderNumber()%>&doctype=ack');">Acknowledgement</A>&l t;/TD> <% } else { %> <TD>Acknowledgement</TD> <% } %> </TR> </TABLE> <% } %> The goal is to catch the case where a null is produced and not show the link. But when I check for the null, it throws the NullPointerException. I have no idea why.

Well, surely there is a stack trace for that exception (if not, you can surround your page with a try... catch and display it yourself). Every application server I know can be persuaded to stick the translated java source for your page in a directory somewhere. With these two ingredients you will know exactly where the NullPointerException is being thrown. - Peter

may be the method getOrderNumber() contains code which throws the exception. u shud place log statements before and after the call to item.getOrderNumber() and also within the method to verify this. or u can have the statement "item.getOrderNumber()" in a try/catch block in the jsp. (just to check if it is indeed the call to "item.getOrderNumber()" that is throwing the excetpion)