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

Finding the Java Sources

As soon as you start developing JSP, you'll run into your first Java error (either a syntax error or an exception). Because JSP is executing Java code instead of the raw JSP source, it can be tricky to figure out exactly where the error occurred.

Let's look at both types of errors and see how to track them down. First, let's create a JSP file with a simple syntax error in Listing 1.6.

Listing 1.6. fiveloop_syntax.jsp
<HTML>
 <HEAD><TITLE>Hello World!</TITLE></HEAD>
 <BODY>
 <%
   int i = 0;
   while (i++ < 5) {
 %>
  Hello World! Loop #
  <% out.print(j); %>
  <br>
 <% }  %>

</BODY>
</HTML>

Luckily, syntax errors generate fairly easy-to-read error messages and even print out the offending line so that you can locate it in your sources ...

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