Server Side Test 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

primitive type

A JSP expression can contain any Java expression that evaluates to a

Data access layer

A Java web application typically contains a presentation layer, a business rules layer, and a ______________________________.

Java

A JavaServer Page consists of _________________ code that's embedded in HTML code.

create a database and all of its tables load data into the tables of a database Correct Response both A and B

A SQL script can be used to

java class

A Servlet is a/an ___________.

static

A __________ web page is one that doesn't change.

self-signed

A _________________________ digital secure certificate is enables you to test SSL connections in a local environment without purchasing a secure certificate.

text area

A _________________________ is similar to a text box, but it can display multiple lines of text.

for a fee from a certificate authority

A digital secure certificate is provided

sql script

A file that stores one or more SQL statements is known as a __________________________________________.

methods

A listener is a class that listens for various events and provides __________________ that respond to those events when they occur.

OR

A method that takes a Student object and writes it to a Student table in a database implements _______________________________ mapping.

context

A parameter that's available to the entire application is called a/an ___________________________ initialization parameter.

java

A scriptlet contains one or more ____________________ statements.

runs on a server

A servlet _____________.

the request object

A servlet can retrieve the current session object by using the getSession method of the

HttpServlet class

A servlet is a Java class that extends the

java

A servlet is a ________ class.

response

A servlet that returns HTML sets the content type as "text/html" in the _____________________________ object.

the first time a browser requests a servlet or JSP from a web site

A session object is created

the server encountered a problem

A status code of 500 informs the user of an application

client/server application

A web application is a type of ________.

HTTP request

A web application starts when a client sends a/an _____to a server.

To deploy an application with a WAR file, you copy it into its document root directory.

All but one of the following is true for a WAR (Web Archive) file. Which one is it?

event

All of the methods for a listener have a/an _______________ object as the sole parameter.

link

An Anchor tag in an HTML document provides a ____________________________ to another web resource such as another web page.

Dynamic

An HTML document that generated by a web application is a ________ web page.

status code, response headers, and response body

An HTTP response consists of the following:

threads

An instance variable of a servlet is shared by any of the ______________________ that request the servlet.

provides a digital secure certificate to the client

Before a server uses SSL to transmit data to a client, it

driver

Before you can use JDBC to connect to a database, your system must have access to a database ______________________________ for the database.

taglib

Before you can use JSTL in a JSP, you need to code a________directive.

jar

Before you can use JSTL in your JSPs, you have to make the JSTL_______ files available to your application.

web.xml

Before you can use a listener, you must use the ________________________ file to register the listener class.

the location of the TLD file

Before you code a custom tag, you use a taglib directive to specify

the tomcat-users.xml file

By default, Tomcat uses a security realm that stores the user data in

cookie

By default, the servlet API uses a _______________________________ to store a session ID.

a limited number of connections are shared by all users of the application

Connection pooling improves database performance because

request

Cookies are retrieved from the __________________________ object.

client

Cookies are stored on the

class

For each custom tag in a TLD, you must specify the name of the tag and the name of the _______ that will be used to implement the tag

data manipulation

INSERT, UPDATE, and DELETE statements are part of SQL's _____________________ language.

sets the third parameter in the prepared statement to the value that's returned by the getPrice method

If ps is a PreparedStatement object and product is a Product object, then the following statement ps.setDouble(3, product.getPrice());

reloads the servlet if it is a later version than the one in memory

If servlet reloading is turned on when a servlet is requested, Tomcat _____________.

request parameters

If the names of the bean properties are the same as the names of the _____________________________________________, you can set the bean properties by specifying an asterisk in the properties attribute of the setProperty tag.

/cart?productionCode=8601

If this code is use for href attribute of an Anchor tag. what url is used for the link?

server

If you attempt to run a JSP that contains a coding error, the _________________________ will display an error page.

java code

If you combine JSTL with EL and the MVC pattern, you should be able to remove most, if not all__________ from of your JSPs.

the HTTP request can't connect with the web server

If you get a Page Cannot Be Displayed error in Internet Explorer,

server.xml file

If you have to change the port that's used by Tomcat, you make the change in the ______________.

init

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

attribute

If you use a custom login form for authentication, the code for the page must use special ______________________ names for the username and password.

threads

If you use instance variables in a JSP, two or more ___________________ may conflict when they try to read, modify, or update the same instance variable at the same time.

scripting

If you want to make sure Java code isn't used in your JSPs, you can disable _______________________ for the application.

Java JDK and Java EE JAR files

If you're developing Java web applications on a Local Area Network, each developer's computer needs these items installed on it:

the web.xml file

In Tomcat, a security constraint is coded in

all rows in the first table and matched rows in the second table

In a left outer join, the result set includes

scope

In a useBean tag, the attributes specify the bean name, class name, and _________________________________.

servlet

In the MVC pattern, the controller is a _________________________.

business

In the MVC pattern, the model consists of _________________________ objects.

JSPs

In the MVC pattern, the view consists of HTML pages and _________________________.

URL rewriting

Instead of storing data that's used for a single request in the session object, you can use hidden fields or __________________________________.

session tracking

Keeping track of users as they move around a web site is known as ___________________________________.

continues to use a secure connection until an absolute URL specifies a non-secure connection

Once you establish a secure connection, the application

JavaBeans

One of the advantages that EL has over standard JSP tags is that you can not only use EL with ___________________ but also with maps, arrays, and lists.

set

One of the disadvantages of using EL is that it doesn't provide a way to _______________ properties.

webappes

One way to deploy a web application is to copy a WAR file into Tomcat's _______________________ directory.

data definition

SQL statements such as the CREATE TABLE and DROP TABLE statements are part of SQL's ___________________________ language.

protocol

SSL (Secure Sockets Layer) is a ____________________________________ used by the Internet that lets clients and servers communicate over a secure connection.

row

The <tr> and </tr> tags in an HTML table are used to mark the start and end of each ____________________________.

displays Update as a hyperlink

The Anchor tag that follows <a href="update.jsp">Update</a>

/root/

The HTML and JSP files for a web application can be stored in the __________________________________________ directory.

one row and four columns into the Download table

The INSERT statement that follows inserts INSERT INTO Download (UserID, DownloadDate, DownloadFilename, ProductCode) VALUES (1, NOW(), 'jr01_filter.mp3', 'jr01')

buttons

The Input tag in an HTML form can be used to create various types boxes and ___________________.

tab-delimited

The MySQL Load command can be used to load data from a _______________________ text file into a database table.

HTTPS

The URL that connects to www.company.com over a secure connection is ________________________________________________.

MIME

The accept header in an HTTP request indicates the __________________________ types that are accepted by the browser.

Netbeans

The best way to develop Java web applications is to use an Integrated Development Environment such as:

Browser

The client uses a ______ to interact with a web application over the internet.

all cookies sent by the browser

The cookie header in an HTTP request provides

doPost

The doGet method of a servlet is often coded so it does nothing but call the ______________________ method.

zero argument

The first rule for defining a JavaBean is to include a ___________________________ constructor.

URL encoding

The following Anchor tag demonstrates how to use <a href="/WorkServlet?shift=<%= shiftCode %>" > View your schedule </a>

display text in server console

The following code from a servlet class System.out.println("Check with system administrator");

httpSession

The getSession method of the HttpSessionEvent class returns the _____________________ object that was created or destroyed.

context initialization parameter

The initParam implicit object lets you use EL to the get value of a

web server

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

the digital secure certificate

The maximum SSL strength for an application's connections is determined by

request parameters

The paramValues implicit object lets you use EL to the values of

authentication

The process of asking users to identify themselves before they can access restricted portions of a web site is referred to as _________________________.

authentication

The process of determining whether a server or client is who and what it claims to be is called ____________________________________.

HTTP

The protocol that's used by a client and a server to communicate in a web application is __________.

two fields from the Accounts table where Balance column is less than 0

The result set retrieved by the following SELECT statement contains records that have SELECT Balance, Num FROM Accounts WHERE Balance < 0

/document root/

The root directory for a web application can be referred to as the ____________________________ directory.

object that stores the bean

The scope of a bean is determined by the

public

The second rule for defining a JavaBean is to not declare any ___________________________ instance variables.

usernames, passwords, and roles

The security realm provides the authorized

web server

The server of a web application requires ________ software.

WEB-INF\classes

The servlets for a web application are stored in this directory and its subdirectories: ______________.

properties

The setProperty method automatically converts all of the primitive data types and their wrapper classes to the data types of the _________________________ in the JavaBeans.

Java code

The standard JSP tags for working with JavaBeans make it easier for non-programmers to use beans because they don't require any _________________________________.

tab order

The tabindex attributes of the controls on a form determines the ______________________ of the controls.

JSPs

The third rule for defining a JavaBean is to provide get, set, and is methods for all of the properties of the bean that need to be accessed by ____________________.

page, request, session, and application

The types of scope that can be used for a JavaBean are

page, request, session, and application

The types of scope that can be used with EL are

by code in a servlet

The value of an initialization parameter is usually retrieved

Set the web server port for the application.

The web.xml file can do all but _________.

/WEB-INF/

The web.xml file is always stored in the ____________________________________ subdirectory of an application.

deployment descriptor

The web.xml file is known as the ________________________________________ for a web application.

implicit request

To access information about the parameters that are sent to a JSP, you can use the methods of the ______________________________ object.

response

To automatically append the session ID to a URL, you can use the encodeURL method of the _______________________________ object.

extend the BodyTagSupport class

To be able to access the body of a tag, the tag handler class needs to

response

To control how a browser caches a page, you would set the cache-control header in the ___________________________ object.

getConnection

To create a Connection object in a web application, you use the _______________________________ method of the DriverManager class.

Connection

To create a Statement object, you use one of the methods of the _____________________________ object.

combo box

To create a drop-down list in HTML that allows a user to select only one option, you can use a ___________________________________________.

-1

To create a per-session cookie, you set the cookie's maximum age to a value of _____________ .

where

To determine which rows in a table are selected, you code a _____________________ clause in a SELECT statement.

servlet reloading

To enable Tomcat to automatically check for servlets that have changed, you should enable __________________________________________.

JSSE

To enable secure connections within Java programs, you use the _____________________________ API.

Post

To ensure that parameter values aren't displayed in the URL when a JSP is requested, you should use the ____________________________method in the Form tag.

executeUpdate

To execute an INSERT statement from a Statement object, you use the _____________________________ method of the Statement object.

statement.executeUpdate(query);

To execute the Delete statement that follows, which statement would you use? String query = "DELETE FROM Invoices " + "WHERE InvoiceTotal = 0 "; Statement statement = connection.createStatement();

getInitParameter

To get an initialization parameter, you use the ___________________________ method.

resultSet

To get data from a result set, you use the get methods of the _______________________________ object.

ResultSetMetaData object

To get information about a result set like the number of columns and names of the columns, you can use the methods of the

cookie

To get the cookies that are available from an HTTP request, you can use the getCookies method to work with the ___________________________ header.

choose

To get the effect of an if/else statement with JSTL, you can use a __________ tag.

pool

To improve the performance of database operations, an application can use a connection ________________________.

directive

To include a file in a JSP at compile-time, you use an include _____________________.

web.xml

To map a servlet to a URL pattern, you add code to the ______________________ file.

ResultSet object

To move the cursor through a result set, you can use the methods of the

executeQuery

To retrieve a result set by executing a SELECT statement from a Statement object, you use the _____________________________ method of the Statement object.

localhost

To run a web application on your own PC, you can use the ______________________ keyword to refer to the host machine.

URL

To run a web application, you can enter a/an _________________________ in your browser.

join

To select data from two or more tables, you can code a _____________________ clause.

use

To select the MySQL database that you want to use, you type the _________________________ command in the MySQL monitor.

current

To set an attribute for a session, you use the setAttribute method of the __________________________ object.

parameter

To specify the location of a _____________________ in the SQL statement for a prepared statement, you type a question mark (?) in the SQL statement.

role

To start Tomcat's Web Application Manager, you need to have a valid username and password for the manager ___________________.

/startup/

To start Tomcat, you can open a DOS Prompt window, change the directory to Tomcat's bin directory, and enter the ________________ command.

mysql

To start the MySQL monitor from a command prompt, you use the ________________________________ command.

submit

To start the action of an HTML form, a form includes a __________________ button.

bin subdirectory

To stop Tomcat, you execute the shutdown command in Tomcat's __________.

session

To store the data for each session, the server creates a __________________________ object.

style sheet

To uniformly apply formatting to HTML tags throughout an application, you can use a ________________________.

JSP directive

To use your own Java class in a JSP, you can import the class with a

engine

To work with servlets and JSPs, the web server must contain the JDK, web server software, and a servlet/JSP _________________________.

log

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.

the first request header

What does the following code display in a JSP? <%@ page import="java.util.*" %> <% Enumeration headerNames = request.getHeaderNames(); String name = (String) headerNames.nextElement(); String value = request.getHeader(name); %> <tr> <td align="right"><%= name %></td> <td><%= value %></td> </tr>

converted to a servlet

When a JSP is requested for the first time, the JSP is ____________.

result set

When a SELECT statement is executed, it returns a _______________________________.

doPost

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

a dialog box automatically prompts the user for a username and password

When an application uses basic authentication,

the web.xml file provides the path for the login page

When an application uses form-based authentication,

JSPs for presentation and servlets for processing

When developing a web application you typically use

the request and response objects

When the doGet method of a servlet is called, it receives

destroy

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

JSP

When you add a tag that has a body to the TLD, you must specify a value of ____________ for the bodycontent element

an ORDER BY clause

When you code an inner join in a SELECT statement you do not need to specify

cell

When you create an HTML document, a table can be nested in one ___________________ of another table.

cast

When you retrieve an attribute for a session, you must _____________________ it to its appropriate type.

scopes

When you use EL to access an attribute, EL automatically searches through all four _______________________ as it looks for the attribute.

runtime

When you use an include action to include a file in a JSP at _____________________, the included file never becomes part of the generated servlet.

container

When you use container-managed security, the servlet __________________ automatically manages security.

columns

When you use the JDBCRealm, you use the context.xml file to identify (a) the database, (b) the tables for the users and roles, and (c) the ___________________ that contain the usernames, passwords, and roles.

the view and model

When you use the MVC pattern, the controller directs the flow of control to

attributes

When you use the MVC pattern, you often add ________________________ to the request object before you forward it to a JSP or another servlet.

JSPs

When you use the Model 1 architecture, ________________________ handle both the request and response.

the request, response, and ServletContext objects

When you use the controller to forward a request to a servlet or JSP, the arguments are

a RequestDispacter object

When you use the controller to forward a request to a servlet or JSP, you use the forward method of

interfaces

When you write a listener class, you implement one of the listener ____________________.

<%-- comment --%>

Which of the following is a valid JSP comment?

a configuration file

Which of the following is not a way to insert data into a table?

the authorized usernames for accessing the restricted resources

Which of the following is not included in a security constraint?

MIME type

Which of the following is not part of the request line in an HTTP request?

the scripting variable for each tag

Which of the following is not specified in a TLD file

${cookie.userPreference.value}

Which of the following is the correct EL code for getting the value of a cookie named userPreference?

To specify the authentication type to be used

Which of the following isn't a case in which you would use response headers?

String type = request.getContentType();

Which, if any, of the following statements is equivalent to this code: String type = request.getHeader("Content-Type");

SELECT * FROM UserRoles

Write a SELECT statement that returns all of the columns and rows from a table named UserRoles.

${times["0"]}

Write the EL code for accessing the first value in an array attribute named times.

(${requestScope.clock.time})

Write the EL code for accessing the time property in an attribute name clock of the request object. (Explicitly specify the scope.)

${clock.time}

Write the EL code for accessing the time property in an attribute named clock.

escape

You can include special characters in an attribute of a JSP tag by using ____________________________ sequences.

Start, stop, reload, or undeploy an application.

You can use Tomcat's Web Application Manager to ____________.

ServletContext

You can use getRealPath method of a/an ______________________________________ object to get the absolute path to a file that's part of a web application.

status

You can use the web.xml file to display an HTML page or JSP for a type of Java exception or an HTTP ___________________________ code.

session

You can write a class that can tell when a/an ________________________ is created or destroyed by implementing HttpSessionListener.

web.xml

You use the auth-method element in the ____________________ file to specify the type of authentication that's going to be used by the application.

HTML

______ is the language that a browser renders into the web pages of an application.

http://localhost:8080

________ url is valid in Tomcat.

HTTP response

____________ is sent from the web server to the client.

a private instance variable and set method

for each attribute, a tag handler must provide

<!--comment -->

how to comment in HTML

jjones net asset.com

if this code is used to parse an attribute named emailAddress that contains a value of jjones@[email protected]

tag

the Java class that carries out the actions of a custom tag is called the ________ class.

the doStartTag method should return EVAL_BODY_BUFFERED

to display the body of a tag

runtime

to provide for URL encoding with JSTL, you can use a____________tag.

the doAfterBody method should return EVAL_BODY_AGAIN

to reiterate the body of a tag


Kaugnay na mga set ng pag-aaral

Scholarly Publication end of course quiz

View Set

NURS 2207- Oncology Evolve EAQ (Graded)

View Set

General Chemistry II: Chapter 18: Thermodynamics

View Set

Chapter 10 - Real Estate License Law / Rules and Regulations

View Set

Maternal/Newborn Success NRS 245 Exam 1

View Set

Success in CLS Ch. 10 Molecular Diagnostics

View Set