O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required