b correct answers Consider the following HTML page code:
<html><body>
<a href="/servlet/HelloServlet">POST</a>
</body></html>
Which method of HelloServlet will be invoked when the hyperlink displayed by the above
page is clicked?
Choose one answer.
a. doPost
b. doGet
c. doHref
d. doForm
e. serviceGet
d correct answers Consider the following HTML page code:
<html><body>
<form name="data" action="/servlet/DataServlet" method="POST">
<input type="text" name="name">
<input type="submit" name="submit">
</form>
</body></html>
Identify the TWO methods that can be used to retrieve the value of the name parameter when
the form is submitted.
Choose one answer.
a. getParameters("name");
b. getParameterValue("name");
c. getValue("name");
d. getParameter("name");
c correct answers Which method in the HttpServlet class services the HTTP POST request?
Choose one answer.
a. doPOST(HttpServletRequest, HttpServletResponse)
b. servicePost(HttpServletRequest, HttpServletResponse)
c. doPost(HttpServletRequest, HttpServletResponse)
d. doPost(ServletRequest, ServletResponse)
e. doPOST(ServletRequest, ServletResponse)
c correct answers The HttpServletResponse lets you:
Choose one answer.
a. specify response headers (Content-Type, Set-Cookie, etc.)
b. specify outgoing information such as HTTP status codes (200, 404, etc.)
c. All of the others.
d. obtain a PrintWriter used to send the document content back to the client.
d correct answers The HttpServletRequest has methods by which you can find out about
incoming information such as:
Choose one answer.
a. form data
, b. HTTP request headers
c. the client's hostname
d. All of the others.
e. cookies
d correct answers Which of the following methods can be used to add cookies to a servlet
response?
Choose one answer.
a. ServletResponse.addCookie(String contents)
b. HttpServletResponse.addCookie(String contents)
c. ServletResponse.addHeader(String name, String value)
d. HttpServletResponse.addCookie(Cookie cookie)
e. ServletResponse.addCookie(Cookie cookie)
c correct answers Consider the following declarations:
1.
GET http://cms.fpt.edu.vn/index.jsp HTTP/1.1
Accept: image/*, application/vnd.txt
Accept-Language: en-cd
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)
Host: www.fpt.edu.vn
2.
HTTP/1.0 404 File Not Found
Connection: Close
Date: Sat, 07 Aug 2010 08:30:30 GMT
Content-Type: text/html
Server: J2EE/ 2.0
Which of the following statements is true?
Choose one answer.
a. The first fragment text describes the HTTP Response
b. None of the other choices
c. The first fragment text describes the HTTP Request
d. The second fragment text describes the HTTP Request
d correct answers Consider the following code statement: