Servlets servlet中的int值

Servlets servlet中的int值,servlets,Servlets,Servlet拒绝让我的iD工作,这是一个int,从这些都是假的学校lol 我怎样才能让它工作?我认为我做得正确,但Servlet停止工作 发生的情况是,由于id INT不起作用,该页面没有加载到ViewStudentSchedule页面。它给了我一个空白页 @WebServlet(urlPatterns = {"/StudentLoginServlet"}) public class StudentLoginServlet extends HttpServlet {

Servlet拒绝让我的iD工作,这是一个int,从这些都是假的学校lol

我怎样才能让它工作?我认为我做得正确,但Servlet停止工作

发生的情况是,由于id INT不起作用,该页面没有加载到ViewStudentSchedule页面。它给了我一个空白页

 @WebServlet(urlPatterns = {"/StudentLoginServlet"})
    public class StudentLoginServlet extends HttpServlet {

        /**
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
         * methods.
         *
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
         */
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            try (PrintWriter out = response.getWriter()) {
                /* TODO output your page here. You may use following sample code. */


                int iD = Integer.valueOf(request.getParameter("iD")).intValue (); 
                String pw = request.getParameter("pw");
                System.out.println(iD);
                System.out.println(pw);


                Student s1=new Student();
                s1.findDB(iD);


                String fn=s1.getFirstName();
                System.out.println(fn);

                String ln=s1.getLastName();
                System.out.println(ln);

                String pwdb=s1.getPassword();
                System.out.println(pwdb);
                RequestDispatcher rd;

                HttpSession ses1=request.getSession();
                ses1.setAttribute("s1", s1);

                if (pw.equals(pwdb)){
                    rd= request.getRequestDispatcher("/ViewStudentSchedule.jsp");
                    rd.forward(request,response);

                }
                else{
                    rd= request.getRequestDispatcher("/LoginError.jsp");
                    rd.forward(request,response);   

                }

            }
        }

        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /**
         * Handles the HTTP <code>GET</code> method.
         *
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
         */
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            processRequest(request, response);
        }

        /**
         * Handles the HTTP <code>POST</code> method.
         *
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
         */
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            processRequest(request, response);
        }

        /**
         * Returns a short description of the servlet.
         *
         * @return a String containing servlet description
         */

        @Override
        public String getServletInfo() {
            return "Short description";
        }// </editor-fold>

    }
问题就在下面
int iD=Integer.valueOfrequest.getParameteriD.intValue

如果你既不说发生了什么,也不说你期望发生什么,你就几乎没有机会得到一个好的答案…哦,发生了什么,页面没有加载到ViewStudentSchedule页面,因为id INT不工作。“不工作”到底是什么意思?您是否在try语句中忘记实现catch子句?