19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

42.15 The statement out.close() is used <strong>to</strong> close the output stream <strong>to</strong><br />

response. Why isn’t this statement enclosed in a try-catch block?<br />

42.16 What happens when you invoke request.getParameter(paramName) if<br />

paramName does not exist?<br />

42.17 How do you write a text field, <strong>com</strong>bo box, check box, and text area<br />

in an HTML form?<br />

42.18 How do you retrieve the parameter value for a text field, <strong>com</strong>bo<br />

box, list, check box, radio but<strong>to</strong>n, and text area from an HTML form?<br />

42.19 If the servlet uses a database driver other than the JDBC-ODBC<br />

driver, where should the driver be placed in NetBeans?<br />

Section 42.8<br />

42.20 What is session tracking? What are three techniques for session<br />

tracking?<br />

42.21 How do you create a cookie, send a cookie <strong>to</strong> a browser, get<br />

cookies from a browser, get the name of a cookie, set a new value in the<br />

cookie, and set cookie expiration time?<br />

42.22 Do you have <strong>to</strong> create five Cookie objects in the servlet in order<br />

<strong>to</strong> send five cookies <strong>to</strong> the browser?<br />

42.23 How do you get a session, set object value for the session, and<br />

get object value from the session?<br />

42.24 Suppose you inserted the following code in line 53 in Listing<br />

42.11.<br />

httpSession.setMaxInactiveInterval(1);<br />

What would happen after the user clicked the Confirm but<strong>to</strong>n from the<br />

browser? Test your answer by running the program.<br />

42.25 Suppose you inserted the following code in line 53 in Listing<br />

42.11.<br />

httpSession.setMaxInactiveInterval(-1);<br />

What would happen after the user clicked the Confirm but<strong>to</strong>n from the<br />

browser?<br />

Section 42.9<br />

42.26 What output stream should you use <strong>to</strong> send images <strong>to</strong> the browser?<br />

What content type do you have <strong>to</strong> set for the response?<br />

42.27 How do you deal with dynamic contents with images and text?<br />

<strong>Programming</strong> Exercises<br />

Section 42.5<br />

NOTE: Solutions <strong>to</strong> even-numbered exercises in this<br />

chapter are in exercise\servletexercise from<br />

evennumberedexercise.zip, which can be downloaded from<br />

the Companion Website.<br />

52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!