Section 1

Preview this deck

When the doGet method of a servlet is called, it receives A. the request and ServletContext objects B. the request and response objects C. the request, response, and ServletException objects D. the request, ServletContext, and ServletException objects

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (27)

Section 1

(27 cards)

When the doGet method of a servlet is called, it receives A. the request and ServletContext objects B. the request and response objects C. the request, response, and ServletException objects D. the request, ServletContext, and ServletException objects

Front

B

Back

Initialization parameters can be added to the ________________ file.

Front

web.xml

Back

To make sure that parameter values aren't displayed in the URL when a servlet is requested, you should use the ____________________ method in the form tag.

Front

post

Back

To write debugging messages from a servlet class to your servlet container's log files, you can use the ______________________ method that you can call directly from any class that extends the HttpServlet class.

Front

log

Back

You can use ________________ to perform data validation on the server. A. jQuery B. a servlet C. JavaScript D. HTML5

Front

B

Back

Within a servlet, instance variables are not ________________ and can result in serious problems.

Front

thread-safe

Back

A servlet is a Java class that extends the A. Servlet class B. HttpGenericServlet class C. HttpServlet class D. HttpServletRequest class

Front

C

Back

You can use ________________, or ________________ to perform data validation on the client. A. jQuery, a servlet B. JavaScript, a servlet C. JavaScript, jQuery D. a servlet, HTML5

Front

C

Back

When an HTML page requests a servlet with the HTTP POST method, the _______________________ method of the servlet class is called.

Front

dopost

Back

The web.xml file consists of XML ________________ that define XML elements.

Front

tags

Back

To define a/an ________________ initialization parameter that's available to a specific servlet, you can code a/an ________________ element within a servlet element. A. context, init-param B. servlet, init-param C. servlet, context-param D. context, context-param

Front

B

Back

When one element is coded within another element, it can be called a/an ________________ element.

Front

child

Back

The following code from a servlet class System.out.println("Check with system administrator"); A. prints text to the standard output stream B. prints text to an HTML page C. prints text to a JSP page D. prints text to a servlet

Front

A

Back

In the code that follows, DiagnoseTrouble <servlet-mapping> <servlet-name>DiagnoseTrouble</servlet-name> <url-pattern>/diagnostics/diagnoseTrouble</url-pattern> </servlet-mapping> A. is the name of the servlet class B. is the internal name for the servlet class that's used in the deployment descriptor C. is the name that's used to request the servle

Front

B

Back

If you need to run some code when a servlet is initialized and loaded into memory, you can use the ______________________ method of the servlet.

Front

init

Back

The following code String[] mailTypes = request.getParameterValues("mail"); A. returns the name of all request parameters from the mail.jsp page B. returns the first value of the mail parameter or null if none exist C. returns all values of the mail parameter or null if none exist D. returns the values of all request parameters from the mail.jsp page E. is invalid

Front

C

Back

When the server removes a servlet from memory, it calls the servlet's ______________________ method.

Front

destroy

Back

To define a/an ________________ initialization parameter that's available to all servlets in the web application, you code a/an ________________ element. A. context, init-param B. servlet, init-param C. servlet, context-param D. context, context-param

Front

D

Back

The root element for the web.xml file is the ________________ element.

Front

web-app

Back

The init method of a servlet class is called A. the first time a servlet is requested but before the service method B. each time the servlet is requested but before the service method C. the first time a servlet is requested but after the service method D. each time the servlet is requested but after the service method

Front

A

Back

The log file for debugging messages can usually be found in the logs directory of the ________________________.

Front

web server

Back

You can use the web.xml file or @WebServlet annotations to provide ________________ that apply to the entire web application or to specific servlets.

Front

initialization parameters

Back

A/an ________________ is the chain of method calls for any statement that calls a method.

Front

/stack trace/

Back

Which of the following statements gets the value of the parameter named occupation? A. String occupation = response.getParameter("occupation"); B. String occupation = request.getParameter("occupation") C. String occupation = response.getValue("occupation"); D. String occupation = request.getValue("occupation") E. None of the above

Front

B

Back

To map a servlet to a URL pattern, you can use the @WebServlet annotation, or you can add code to the ______________________ file.

Front

web.xml

Back

The doGet method of a servlet is called when the servlet receives an HTTP ______________________ request.

Front

get

Back

In the code that follows, the servlet is mapped to <servlet-mapping> <servlet-name>DiagnoseTrouble</servlet-name> <url-pattern>/diagnostics/diagnoseTrouble</url-pattern> </servlet-mapping> A. the /diagnostics/diagnoseTrouble URL of the document root directory B. the /diagnostics/diagnoseTrouble URL of the current directory C. any URL in the /diagnostics/diagnoseTrouble directory of the document root directory D. any URL in the /diagnostics/diagnoseTrouble directory of the current directory

Front

A

Back