I think the problem is with the following line.
session.getAttribute("serNo").toString().equals("")
If you do not have serNo, it will return null and NOT empty ("") which you
are checking. The best option could be to get these values in variables, by
putting them in a try..catch.
For ex.
String serno;
try{
serno=session.getAttribute("serNo");
// You are here if serno is NOT null ... (write your code below)
// You can have another try..catch here to check the next variable and
so on.
}
catch (NullPointerException npe)
{
// You are here if serno IS null ... (write your code below)
}
It should work, logically. You need to test it out.
Best Regards,
Dantus
----- Original Message -----
From: Sachin S. Khanna <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 13, 2001 12:19 PM
Subject: Re: Internal Server Error
> One possible reason for the NullPointerException could be that you are not
> checking for null in your code.
> Try the following :
> After retrieving an object from the session check for null before calling
> the toString() method on it.
> Assume this will put you in the right direction to solving your problem.
> Have a nice day.
> With regards,
> Sachin S. Khanna.
> www.emailanorder.com
>
> ----- Original Message -----
> From: Sello Mathibe <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 12, 2001 7:11 PM
> Subject: Re: Internal Server Error
>
>
> > Thanks. The following JSP I use to call either LeaveForm.jsp or
> > busUnManResp.jsp. Whenever I call it, I get the error that follows the
> code.
> >
> > <%@ page contentType="text/html;charset=WINDOWS-1252"%>
> > <FRAMESET COLS="100%,0%" ROWS = "60%,40%">
> > <%if (!session.getAttribute("serNo").toString().equals("")) {%>
> > <FRAME
> > SRC="LeaveForm.jsp?serNo=<%=session.getAttribute("serNo")%>">
> > <FRAME SRC="">
> > <FRAME
> SRC="BusUnManRep.jsp?serNo=<%=session.getAttribute("serNo")%>">
> > <%}else if
> >
(session.getAttribute("typeOf").toString().equals("BusinessUnitManager")||
> > (
> > (session.getAttribute("typeOf").toString().equals("NormalEmployee"))&&
> >
>
(!request.getParameter("serNo").toString().equals("")) ) ){%>
> > <FRAME
> SRC="LeaveForm.jsp?serNo=<%=request.getParameter("serNo")%>">
> > <FRAME SRC="">
> > <FRAME
> > SRC="BusUnManRep.jsp?serNo=<%=request.getParameter("serNo") %>">
> > <%} else {%>
> > <FRAME SRC="LeaveForm.jsp?serNo=""">
> > <FRAME SRC="">
> > <FRAME SRC="BusUnManRep.jsp?serNo=""">
> > <%}%>
> > </frameset>
> >
> > The ERROR:
> >
> > Error: 500
> > Location: /LeaveForm/BusUnManRep.jsp
> > Internal Servlet Error:
> >
> > org.apache.jasper.JasperException: Unable to compile class for JSP
> > void
> >
>
org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletR
> > equest, javax.servlet.http.HttpServletResponse)
> > void
> > javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
> > javax.servlet.ServletResponse)
> > void
> >
>
org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Reque
> > st, org.apache.tomcat.core.Response)
> > void
> > org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
> > org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request
> > , org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core
> > .Request, org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request
> > , org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (org.apache.tomcat.service.TcpConnection, java.lang.Object[])
> > void
> > org.apache.tomcat.service.TcpWorkerThread.runIt(java.lang.Object[])
> > void org.apache.tomcat.util.ThreadPool$ControlRunnable.run()
> > void java.lang.Thread.run()
> >
> > Root cause:
> > java.lang.NullPointerException
> > void
> >
>
org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletR
> > equest, javax.servlet.http.HttpServletResponse)
> > void
> > javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
> > javax.servlet.ServletResponse)
> > void
> >
>
org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Reque
> > st, org.apache.tomcat.core.Response)
> > void
> > org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
> > org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request
> > , org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core
> > .Request, org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request
> > , org.apache.tomcat.core.Response)
> > void
> >
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (org.apache.tomcat.service.TcpConnection, java.lang.Object[])
> > void
> > org.apache.tomcat.service.TcpWorkerThread.runIt(java.lang.Object[])
> > void org.apache.tomcat.util.ThreadPool$ControlRunnable.run()
> > void java.lang.Thread.run()
> >
> >
> >
> >
> > -----Original Message-----
> > From: Sachin S. Khanna [mailto:[EMAIL PROTECTED]]
> > Sent: 12 March 2001 12:26
> > To: [EMAIL PROTECTED]
> > Subject: Re: Internal Server Error
> >
> >
> > Well if you go through the error that is being generated you fill find
> that
> > it states that the root cause for the error is
> > java.lang.NullPointerException.
> > If you provide us the code we might be able to help you further.
> > Have a nice day.
> > With regards,
> > Sachin S. Khanna.
> > www.emailanorder.com
> >
> > ----- Original Message -----
> > From: Sello Mathibe <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, March 12, 2001 3:00 PM
> > Subject: Internal Server Error
> >
> >
> > > Hi Gurus! I'm still a newbie to JSPs and Servlets, can you please tell
> me
> > > what the error below means. I'm currently running NT 4, Apache +
Tomcat.
> I
> > > get the error when I try to access the JSP page. I've defined my
> servlets
> > in
> > > my web.xml and server.xml. All the other JSPs are running quite good
> > except
> > > for the other one. I think the problem might be with the
> > > org.apache.jasper.JasperException.
> > > Can somebody out there help me? I will really appreciate it.
> > > Thank You
> > > Error: 500
> > > Location: /LeaveForm/BusUnManRep.jsp
> > > Internal Servlet Error:
> > > org.apache.jasper.JasperException: Unable to compile class for JSP
> > > void
> > >
> >
>
org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletR
> > > equest, javax.servlet.http.HttpServletResponse)
> > > void
> > > javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
> > > javax.servlet.ServletResponse)
> > > void
> > >
> >
>
org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Reque
> > > st, org.apache.tomcat.core.Response)
> > > void
> > > org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
> > > org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request
> > > , org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core
> > > .Request, org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request
> > > , org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > > (org.apache.tomcat.service.TcpConnection, java.lang.Object[])
> > > void
> > > org.apache.tomcat.service.TcpWorkerThread.runIt(java.lang.Object[])
> > > void org.apache.tomcat.util.ThreadPool$ControlRunnable.run()
> > > void java.lang.Thread.run()
> > > Root cause:
> > > java.lang.NullPointerException
> > > void
> > >
> >
>
org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletR
> > > equest, javax.servlet.http.HttpServletResponse)
> > > void
> > > javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
> > > javax.servlet.ServletResponse)
> > > void
> > >
> >
>
org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Reque
> > > st, org.apache.tomcat.core.Response)
> > > void
> > > org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request,
> > > org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request
> > > , org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core
> > > .Request, org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request
> > > , org.apache.tomcat.core.Response)
> > > void
> > >
> >
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > > (org.apache.tomcat.service.TcpConnection, java.lang.Object[])
> > > void
> > > org.apache.tomcat.service.TcpWorkerThread.runIt(java.lang.Object[])
> > > void org.apache.tomcat.util.ThreadPool$ControlRunnable.run()
> > > void java.lang.Thread.run()
> > >
> > >
> >
>
===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > > http://java.sun.com/products/jsp/faq.html
> > > http://www.esperanto.org.nz/jsp/jspfaq.html
> > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > >
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets