Appendix D. Exercise Solutions
Chapter 1 Exercises
Exercise 1
To modify the index.jsp
file in the third example to display a page similar to Figure 1-17, create a index1.jsp
page containing the following code:
<%@ taglib prefix="wroxtags" tagdir="/WEB-INF/tags" %> <html> <head> <title><wroxtags:bookTitle/></title> </head> <body> <h1><wroxtags:bookTitle/></h1> <p><i>published by <wroxtags:publisher/></i></p> <p><small>Note: You will need <wroxtags:containerName/> to use this book.</small></p> </body> </html>
Exercise 2
There is a tag called showBrowser.tag
in the WEB-INF/tags
directory. You will need to use this tag in creating index2.jsp
:
<%@ taglib prefix="wroxtags" tagdir="/WEB-INF/tags" %> <html> <head> <title>Book Information</title> </head> <body> <h1>Book Information</h1>
<hr> <p>The name of this book is <i><wroxtags:bookTitle/></i>.</p> <p>It is published by <wroxtags:publisher/>.</p> <p>The server used in all the examples is <wroxtags:containerName/>.</p> <p>The browser you are using is <wroxtags:showBrowser/>.</p> </body> </html>
Chapter 2 Exercises
Exercise 1
Create a showportal.jsp
file that contains the following:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <link rel=stylesheet type="text/css" href="portal.css"> <title>New Portal</title> </head> <body> <jsp:include page="news.jsp" > <jsp:param name="mode" value="standalone"/> </jsp:include> <jsp:include page="weather.jsp" > <jsp:param name="mode" value="standalone"/> </jsp:include> <jsp:include ...
Get Beginning JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.