What is different between these two code lines and when should we use each of them?
1.
RequestDispatcher view = request.getRequestDispatcher(“result.jsp”);
2.
RequestDispatcher view = getServletContext().getRequestDispatcher(“/result.jsp”);
What is different between these two code lines and when should we use each of them?
1.
RequestDispatcher view = request.getRequestDispatcher(“result.jsp”);
2.
RequestDispatcher view = getServletContext().getRequestDispatcher(“/result.jsp”);
1)
RequestDispatcher view = request.getRequestDispatcher(“result.jsp”);
Here,
java doc says,
2) RequestDispatcher view = getServletContext().getRequestDispatcher(“/result.jsp”);
Here,
java doc says,