Please answer the following question:
Given the following code snippet, what would be the output you can expect to see on the web page? Mark
Please select one correct answer.
// Calling
servlet:
public void doGet(HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML><BODY>");
out.println("I am calling others!");
RequestDispatcher rd= req.getRequestDispatcher("/MyServlet");
rd.include(req, res);
out.println("</BODY></HTML>");
out.close();
}
// Target servlet:
protected void doGet(HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException
{
PrintWriter out = res.getWriter();
out.println("I am called by others!");
}
A : "I am calling others!".
B : "I am called by others!".
C : Both "I am calling others!" and "I am called by others!".
D : An
IllegalStateException is thrown.
E : An IOException is thrown.
What would be the correct answer