19.09.2015 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

42.11*<br />

Cookie 3: name is “count” and value is 2.<br />

(Retrieve cookies) Write a servlet that displays all the cookies on<br />

the client. The client types the URL of the servlet from the browser<br />

<strong>to</strong> display all the cookies s<strong>to</strong>red on the browser. See Figure 42.35.<br />

Figure 42.35<br />

All the cookies on the client are displayed in the browser.<br />

Comprehensive<br />

42.12***<br />

(Syntax highlighting) Create an HTML form that prompts the user <strong>to</strong><br />

enter a <strong>Java</strong> program in a text area, as shown in Figure 42.36a. The<br />

form invokes a servlet that displays the <strong>Java</strong> source code in a<br />

syntax-highlighted HTML format, as shown in Figure 42.36b. The<br />

keywords, <strong>com</strong>ments, and literals are displayed in bold navy, green,<br />

and blue, respectively.<br />

(a)<br />

(b)<br />

Figure 42.36<br />

The <strong>Java</strong> code in plain text in (a) is displayed in HTML with<br />

syntax highlighted in (b).<br />

42.13**<br />

(Access and update a Staff table) Write a <strong>Java</strong> servlet for Exercise<br />

33.1, as shown in Figure 42.37.<br />

57

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

Saved successfully!

Ooh no, something went wrong!