Solved

Error compiling JSP file

Posted on 2004-03-20
1
206 Views
Last Modified: 2010-04-01
I'm getting the following errors when I try to compile the JSP file that follow.  Any help with this greatly appreciated.

trackingErrorPage$jsp.java [118:1] 'else' without 'if'
                        else if (exception instanceof Class NotFoundException )
                        ^
trackingErrorPage$jsp.java [130:1] 'else' without 'if'

JSP file follows below:

?xml version = "1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!-- trackingErrorPage.jsp -->

<%-- page settings --%>
<%@ page isErrorPage = "true" %>
<%@ page import = "java.util.*" %>
<%@ page import = "java.sql.*" %>

<html xmlns = "http://www.w3.org/1999/xhtml">

<head>
<title>Error!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
    .error


{
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #660033;
}

</style>
</head>

<body>
    <p class = "error">

    <% // scriptlet to determine exception type
       // and output beginning of error message
       if ( exception instanceof SQLException )
    %>

        An SQLException

    <%
        else if (exception instanceof Class NotFoundException )
    %>    
     
        A ClassNotFoundException

    <%
        else
    %>

        An exception

    <%-- end scriptlet to insert fixed template data --%>

        <%-- continue error message output --%>
        occurred while entering data in the tracking database.

    </p>

    <p class = "error">
        The error meassage was:<br />
        <%= exception.getMessage() %>
    </p>

    <p class = "error">Please try again later.</p>
    </body>

</html>
   
0
Comment
Question by:timjg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
kennethxu earned 125 total points
ID: 10641121
try this:

    <% // scriptlet to determine exception type
       // and output beginning of error message
       if ( exception instanceof SQLException ) {
    %>

        An SQLException

    <%
        } else if (exception instanceof Class NotFoundException ) {
    %>    
     
        A ClassNotFoundException

    <%
        } else {
    %>

        An exception

     <%
        }
     %>

    <%-- end scriptlet to insert fixed template data --%>
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question