Internet and Web Resources

Answers to Self Review Exercises

27.1

a) . b) directives, actions, scripting elements, tag libraries. c) application, page, request, session. d) include. e) javax.servlet.jsp, javax.servlet.jsp.tagext. f) JSP container. g) scriptlets, comments, expressions, declarations, escape sequences.

27.2

a) False. Objects with page scope exist only as part of the page in which they are used. b) True. c) False. Action enables dynamic content to be included in a JavaServer Page. d) False. JSP comments and script-language comments are ignored and do not appear in the response. e) False. Objects with application scope are part of the JSP container application. f) True. g) True. h) True.

Exercises

27.3

Write a JSP page to output the string "Hello world!" ten times.

27.4

Modify Exercise 26.6 to run as a JSP page.

27.5

Rewrite Figure 27.15 to provide a form that allow users to select a book title and view the book's cover. Use a JSP expression instead of the getProperty JSP tag.

27.6

Create a JSP- and JDBC-based address book. Use the guest-book example of Fig. 27.20 through Fig. 27.24 as a guide. Your address book should allow the user to insert entries and search for entries. [Note: If you are not familiar with XHTML and CSS, refer to the chapters from our book Internet & World Wide Web HTP, 3/eIntroduction to XHTML: Part 1, Introduction to XHTML: Part 2 and Cascading Style Sheets (CSS), which are included as PDF documents on the CD that accompanies this book.]

27.7

Reimplement the Web application of Fig. 26.21 (favorite animal survey) using JSPs. [Note: If you are not familiar with XHTML and CSS, refer to the chapters from our book Internet & World Wide Web HTP, 3/eIntroduction to XHTML: Part 1, Introduction to XHTML: Part 2 and Cascading Style Sheets (CSS), which are included as PDF documents on the CD that accompanies this book.]

27.8

Modify your solution to Exercise 27.7 to allow the user to see the survey results without responding to the survey. [Note: If you are not familiar with XHTML and CSS, refer to the chapters from our book Internet & World Wide Web HTP, 3/eIntroduction to XHTML: Part 1, Introduction to XHTML: Part 2 and Cascading Style Sheets (CSS), which are included as PDF documents on the CD that accompanies this book.]

Категории