PRJ301_-_FEB5_-_FA_2023_1299.webp
Q

PRJ301_-_FEB5_-_FA_2023_1299.webp

(Choose 1 answer)
public void doGet(HttpServletRequest req, HttpServletResponse res)
try
}
Following is the code for doGet() and doPost() method of TestServlet.Which of the statement is correct?
PrintWriter pw res.getWriter();
pw.println("<html><head></head><body>");
String name = req.getParameter("name");
String[] hobbies req.getParameterValues("hobbies");
A. It'll throw an exception at runtime only if a POST request is sent to it.
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]);
B. It'll throw an exception at runtime, as you cannot call doGet() from doPost().
C. This will work for HTTP GET as well as POST requests.
catch (Exception e)
D. This will only work for HTTP GET requests
e.printStackTrace();
E. This will only work for HTTP POST requests
public void doPost(HttpServletRequest req, HttpServletResponse res)
doGet (req, res);
}
}

Elt

Thông tin

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

Image metadata

Filename
PRJ301_-_FEB5_-_FA_2023_1299.webp
File size
88 KB
Dimensions
1926px x 906px

Share this media

Back
Bên trên Bottom