PRJ301_-_FA_2024_-_RE_3071.webp
K

PRJ301_-_FA_2024_-_RE_3071.webp

Kizspy | Question: 11 (Choose 1 answer)
Suppose the following HTML code is used to enter user information and call the servlet url-pattern "Record":
<html><body>
<form action="Record" >
User:<input type="text" id="txtname1" name="txtname2"><br>
Address:<input type="text" id="txtadd1" name="txtadd2"><br>
<input type="submit" value="GotoZone">
</form>
</body></html>
Which of the Servlet code takes input from an html form and displays it on the browser?
A. public class RecordServlet extends HttpServlet
{ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{ PrintWriter pw=res.getWriter();res.setContentType("text/html");String account-req.getParameter("txtname1");String Addr=req.getParameter("txtadd1");pw.println("Hello" + account + "from" + Addr);pw.close();
}
}
FUOVER
}
B. public class RecordServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {
PrintWriter pw=res.getWriter();res.setContentType("text/html");
String account-req.getParameter("txtname2");String Addr=req.getParameter("txtadd2");pw.println("Hello" + account + "from" + Addr);pw.close();
}
C public class RecordServlet extends HttpServlet

Thông tin

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

Share this media

Back
Bên trên Bottom