Cleaning Things Up

At this stage, the code is in good shape, for the most part, but you can still do a few things to make it better. For example, you have the same JSP in several different places. The code that produces the featured product is the same as the code for the product detail page. The code for the listing by author and by category are also the same. If you put them all into includes, it will reduce the size of the parent files and also reduce the number of places in the code that will need to be changed if you want to alter the files.

You should also think a little more carefully about what would happen if a ProductActivityException was thrown. You should be using a try to catch it and redirect to an error page.

And speaking of error ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL 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.