Results 1 to 2 of 2
  1. #1
    doflynn is offline Member
    Join Date
    Feb 2008
    Posts
    4
    Rep Power
    0

    Default Concurring Java Problem...PLease Please Help

    When I run my java application this error keeps coming up when trying to log in. Yer help would be much appreciated

    HTTP Status 500 -
    --------------------------------------------------------------------------------

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: Exception in JSP: /HeadNPass.jsp:19

    16:
    17:
    18: NurseDao da = new NurseDao();
    19: Nurse n = da.getNurse(userName);
    20:
    21: if(n != null)
    22: {

    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:504)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:368)


    root cause

    java.lang.NullPointerException
    hospital.NurseDao.getNurse(NurseDao.java:324)
    org.apache.jsp.HeadNPass_jsp._jspService(HeadNPass _jsp.java:63)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:368)




    --------------------------------------------------------------------------------

    The code is as follows:


    String userName = request.getParameter("username");
    String password = request.getParameter("password");


    if ((userName != null) && (password != null)){


    NurseDao da = new NurseDao();
    Nurse n = da.getNurse(userName);

    if(n != null)
    {
    int pw = Integer.parseInt(password);
    if(n.getStaffId() == pw)
    {
    request.getSession(true).setAttribute("HEADNURSE", n);
    response.sendRedirect("HeadNurse.jsp");
    }
    else
    {
    response.sendRedirect("error.jsp");
    }
    }
    else
    {
    response.sendRedirect("error.jsp");
    }

  2. #2
    jelly's Avatar
    jelly is offline Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    46
    Rep Power
    0

    Default

    The failure is saying that you have a Null Pointer Exception in your NurseDAO code at line 324 :-
    Java Code:
    ...
    hospital.NurseDao.getNurse(NurseDao.java:324)
    ...
    Have a look at the code at line 324 in the NurseDAO class ( or possibly one or two lines either way. These will be in the getNurse method and it is where you are getting the exception. If you get problems post the code from that method and we'll try to help
    -- Hope that helps

Similar Threads

  1. Concurring Java Problem..Please Help
    By doflynn in forum New To Java
    Replies: 3
    Last Post: 02-04-2008, 04:14 PM
  2. Concurring Java Problem
    By doflynn in forum NetBeans
    Replies: 0
    Last Post: 02-04-2008, 02:20 PM
  3. Problem in java
    By saytri in forum New To Java
    Replies: 4
    Last Post: 01-16-2008, 10:09 PM
  4. JAVA if problem
    By toby in forum New To Java
    Replies: 2
    Last Post: 07-25-2007, 07:58 PM
  5. java SE 6 problem
    By techlance in forum Java Applets
    Replies: 1
    Last Post: 06-28-2007, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •