Jsp 获取hashmap.get()方法上的空指针异常

Jsp 获取hashmap.get()方法上的空指针异常,jsp,servlets,model-view-controller,javabeans,Jsp,Servlets,Model View Controller,Javabeans,当我在.get方法中放置属性时,我似乎收到了一个nullpointer异常。当我调用Entire集合时,它会打印我想要的代码。如果有人能帮上忙的话,我会非常感激的,因为我是个新手 session.setAttribute("AvailableLessons",availableLessons.getLessons()); will print out contents of the hashmaps. session.setAttribute("Availab

当我在.get方法中放置属性时,我似乎收到了一个nullpointer异常。当我调用Entire集合时,它会打印我想要的代码。如果有人能帮上忙的话,我会非常感激的,因为我是个新手

        session.setAttribute("AvailableLessons",availableLessons.getLessons()); will print out contents of the hashmaps. 

        session.setAttribute("AvailableLessons",availableLessons.getLessons(Lesson.description)); will return null pointer expcetion and the property is a db column name and when i step through it, will have a value in the property. 
以下是代码的其余部分:

        private LessonTimetable availableLessons =  new LessonTimeTable();
        HttpSession session = request.getSession();
        session.setAttribute("Username", username);
        response.sendRedirect("/coursework/LessonTimetableView.jspx");
        String printOut = ((String) session.getAttribute("Username"));
        out.print("You are logged in as " + printOut);
        session.setAttribute("AvailableLessons",availableLessons.getDescription());
以下是堆栈跟踪:

java.lang.NullPointerException
controller.Controller.processRequest(Controller.java:79)
controller.Controller.doPost(Controller.java:88)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

availibleLessons可以为null,description属性可以为null,没有剩下的代码很难知道。有趣的是,这是AvilableLesson会打印出hashmap的所有内容,所以我知道它不是Null一旦我指定了它返回Null的键,你能分享堆栈跟踪吗?你能分享这个值availableLessons.getLessonsLesson.description,看看你得到了什么。可能是空的。