13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

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

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

18.11 Exercises42118.10RESOURCESThe definitive place for all the details is the Java Web site at Sun, 3 particularlythe pages dealing with javax.servlet.http classes.Some of the best material <strong>on</strong> servlets comes from:• Core Servlets and JavaServer Pages by Marty Hall and Larry Brown, ISBN0-13-009229-0, a Prentice Hall PTR book.• Its sequel, More Servlets and JavaServer Pages by Marty Hall, ISBN0-13-067614-1, also by Prentice Hall PTR.• Java Servlet Programming, Sec<strong>on</strong>d Editi<strong>on</strong> by Jas<strong>on</strong> Hunter and WilliamCrawford, ISBN 0596000405, from O’Reilly.18.11EXERCISES1. Modify the BudgetPro servlet so that it resp<strong>on</strong>ds differently for thedoGet() and doPost() methods. Have doPost() c<strong>on</strong>tinue to work asis, but have doGet() report the number of different users and the numberof accounts that they have created. (You may need to “instrument” thecode—that is, add additi<strong>on</strong>al statements—to start counting such things.)2. Change BudgetPro to do its output <strong>on</strong> the fly instead of building the entirepage before output. Can you notice any difference in the display time?3. Design error handling for BudgetPro to prevent the user from allocatingmore than is available in the (sub)account. Will you use Java excepti<strong>on</strong>s?If so, which object will throw them and which will catch them? How willyou inform the user of the error? Implement your design.3. http://java.sun.com/j2ee/1.4/docs/api/

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

Saved successfully!

Ooh no, something went wrong!