PRJ301_-_SP_2023_-_FE_125.webp
M

PRJ301_-_SP_2023_-_FE_125.webp

  • Media owner Maki95
  • Ngày thêm
Multiple Choices
Answer (Choose 1 answer)
Following is the code for doGet() and doPost() method of TestServlet.
Which of the statement is correct?
A. This will only work for HTTP GET requests
B. This will only work for HTTP POST requests
C. It'll throw an exception at runtime, as you cannot call doGet() from doPost().
D. This will work for HTTP GET as well as POST requests.
}
E. It'll throw an exception at runtime only if a POST request is sent to it.
}
public void doGet (HttpServletRequest req, HttpServletResponse res)
try
{
PrintWriter pw res.getWriter();
pw.println("<html><head></head><body>");
String name = req.getParameter("name");
String[] hobbies = req.getParameterValues("hobbies");
pw.println("Hello, "+name+"!<br> As I understand, your hobbies are for(int i=0; i< hobbies.length; i++)pw.println("</body></html>");pw.println("<br>"+hobbies[i]
catch (Exception e)
{
}
e.printStackTrace();
public void doPost(HttpServletRequest req, HttpServletResponse res)
{
}
doGet (req, res);
Ex

Thông tin

Category
PRJ301
Thêm bởi
Maki95
Ngày thêm
Lượt xem
2,318
Lượt bình luận
15
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom