Ok i need some help with this JSP page that has some java in it. My assignment is to create a fictional webpage that requires a login or registration and that checks with the database to make sure that it will verify that no user with the proposed user id presently exist.

When i try to compile this program i get the following error:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 30 in the generated java file
Syntax error, insert "}" to complete ClassBody

An error occurred at line: 336 in the generated java file
Syntax error, insert "else Statement" to complete IfStatement

An error occurred at line: 336 in the generated java file
Syntax error, insert "}" to complete Block

An error occurred at line: 336 in the generated java file
Syntax error, insert "else Statement" to complete IfStatement

An error occurred at line: 336 in the generated java file
Syntax error, insert "}" to complete Block

An error occurred at line: 347 in the generated java file
Syntax error on token "}", delete this token

Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.

__________________________________________________

<!-- Project 1-->
 <%@ page import="java.sql.*, javax.swing.*, java.awt.event.*"%>
<Html>
<Head>
<Title>
Hummingbirds
</Title>

           <style type="text/css">
           .style1   {
             	border-style: solid;
	            border-width: 2px;
                     }
           .style2   {
	            font-size: x-small;
                     }
           .style3   {
	            font-size: large;
	            text-decoration: underline;
                     }
           .style4   {
 	            text-align: center;
                     }
           .style6   {
            	font-size: x-small;
	            text-decoration: underline;
                     }
           .style7   {
             	background-color: #FFFFFF;
					}
		   .style9  {
				border-style: solid;
				border-width: 2px;
				vertical-align: middle;
					}
   		   .style10 {
				text-align: left;
					}
     	   .style14 {
				text-align: center;
				font-size: x-large;
				margin-bottom: 0px;
					}
		   </style>

</Head>
	</html>
	<!-- Row one -->
		<Body bgcolor="#008080" LINK="#0000FF" VLINK="#FF0000">
        <p style="height: 940px; width: 557px;">
        <table align="center" style="width: 100%">
	    <tr>
		<td class="style10" style="height: 145px; " colspan="2">
		<img alt="Hummingbird Feeder" height="151" src="Hummingbird3.jpg" width="942"></td>
			<td class="style4" style="height: 145px; width: 246px">
		&nbsp;
		<div class="style4">
		<div class="style4" style="height: 62px">

<% if(request.getParameter("login") == null && request.getParameter("noreg") == null && request.getParameter("register") == null){ %>
		<form action="test1.jsp" method="post" style="width: 213px">
			<div class="style4">
			<font size="3" face="Times" color="#000000"> Email: </font><input type="text" name="email" value="">
			<font size="3" face="Times" color="#000000">  Password: </font><input type="password" name="pwd" size="10"><br>
			<input type="Submit" name="Login" value="Login">
			<input type="submit" name="Register" value="Register"></div>
		</form>
		
<%  }

if (request.getParameter("login") != null)
    {
    Class.forName("com.mysql.jdbc.driver");
    String dbURL = "jdbc:mysql://localhost:3306/********";
        Connection dbCon = DriverManager.getConnection(dbURL, "*******", "*******");
        Statement stmt = dbCon.createStatement();

        String query = "SELECT * FROM users WHERE e_mail = '"+ request.getParameter("userid") +"'";
        ResultSet rs = stmt.executeQuery(query);

        String dbFName = new String("");
        String dbLName = new String("");
        String dbUserID = new String("");
        String dbPassword = new String("");

        if (rs.next())
        {
        dbFName = rs.getString("f_name");
        dbLName = rs.getString("l_name");
        dbUserID = rs.getString("email");
        dbPassword = rs.getString("passw");
        
        if (dbUserID.equalsIgnoreCase(request.getParameter("email")) && dbPassword.equals(request.getParameter("password")))
        { %>

		 <form method="post" action="test1.jsp">
                         <table class="log" align="middle">Hummingbird Member - Welcome - </td>
                            <td class="log" align="middle"><font class="t">
                            <%out.print(dbFName);%>
                            <%out.print(dbLName);%>
                                        </font></td>
                                    <td class="log" align="middle" style="vertical-align:top"><input type="submit" name="logout" value="Logout"/></td>
                                </tr>
                            </table>
         </form>
        <% }
        else
           { %>
            <form method="post" action="test1.jsp">
            			<table class="log" align="middle"><font class="t"> Incorrect Password, please try again!</font></td>
            			<td class="log" align="middle" style="vertical-align:top"><input type="submit" name="retry" value="Retry"/></td>
            			</tr>
            	</table>
            </form>
        <% }
           }
        else
           { %>
            <form method="post" action="test1.jsp">
                <table class="log" align="middle"><font class="t">Incorrect UserID, try again or register if not already!</font></td>
                <td class="log" align="middle" style="vertical-align:top"><input type="submit" name="retry" value="Retry"/></td>
                <td class="log" align="middle" style="vertical-align:top"><input type="submit" name="notreg" value="Not Registered?"/></td>
                </tr>
                </table>
                </form>
        <% }
           dbCon.close();
           }
        if (request.getParameter("notreg") != null)
           { %>
 		<form action="test1.jsp" method="post">
		<div class="style1">
		<table cellspacing="5" border="0">
       	    <tr>
	      	<td align="right">* First name:</td>
	      	<td><input type="text" name="FName"></td></tr>
            <tr>
      		<td align="right">* Last name:</td>
      		<td><input type="text" name="LName"></td>
    		</tr>
    		<tr><td align="right">* Email Address:</td>
      		<td><input type="text" name="User"></td>
    		</tr><tr>
    		<td align="right">*Password:</td>
    		<td><input type="password" name="Pwd"></td>
    		</tr>
    		<tr><td align="right">*Retype Password:</td>
    		<td><input type="password" name="Vpwd"></td>
    		</tr>
    		<tr>
      		<td class="style4"><input type="submit" value="Cancel"></td>
			<td class="style4"><input type="submit" value="Submit"></td>
    		</tr>
  		</table><br><br><br><br></div>
  		</form>

<% } if (request.getParameter("register") !=null)
{
    Class.forName("com.mysql.jdbc.Driver");
    String dbURL = "jdbc:mysql://localhost:3306/********";
    Connection dbCon = DriverManager.getConnection(dbURL, "*******", "*******");
    Statement stmt = dbCon.createStatement();

    String query = "SELECT * FROM users WHERE e_mail = '"+ request.getParameter("email" +"'");
    ResultSet rs = stmt.executeQuery(query);

	  if (rs.next())
        { %>

		<form method="post" action="test1.jsp"
        <table classs="log" width="100%">
        	<br><br>
        <tr> <td class="log" align="middle" style="width: 517px; height: 30px"><font class="t"> that account already exist. Try different Email!</font></td>
        <td class="log" align="middle" style="vertical-align:top; width: 217px; height: 30px;"><input type="submit" name="notreg" value="Retry"/></td>
        </tr>
        </table>
        </form>

	<% }
    else
        {
if (request.getParameter("pwnew").equals(request.getParameter("pwcheck")) && (!(request.getParameter("pwnew").equals(""))))
        {
String command = "INSERT INTO users(f_name,l_name,e_mail,passw) values('"+ request.getParameter("fname") +"','"+ request.getParameter("lname") +"','"+ request.getParameter("email") +"','"+ request.getParameter("pwnew") +"')";
         stmt.executeUpdate(command); %>
        <form method="post" action="index.jsp"
        <table class="log" width="100%"
        <tr><td class="log" align="middle"><font class="t">Account registered, you may now log in!</font></td>
        <td class="log" align="middle" style="vertical-align:top"><input type="submit" name="home" value="Home"/></td>
        </tr>
        </table>
        </form>

<% }
else
{ %>
<form method="post" action="test1.jsp">
<table class="log" width=100%>
    <tr><td class="log" align="middle"><font class="t">Passwords did not match or may not have been entered. Please try again!</font></td>
    <td class="log" align="middle" style="vertical-align:top"><input type="submit" name="notreg" value="Retry"/></td>
    </tr>
</table>
</form>

< % }
}
stmt.close();
dbCon.close();
} %>

	


<!-- Row two -->		
		<tr>
		
		<td class="style10" colspan="3" style="height: 20px" valign="top">
		<h2 style="width: 1258px; height: 17px;" class="style14">The Most important Pollinators</h2></td>
		</tr>
		<tr>
		<td class="style10" colspan="3" style="height: 100px" valign="top"><b>
		<strong><span class="style3">

<!-- Row three -->
		<img alt="Hum2" class="style1" height="122" src="Hummingbird2.jpg" style="float: right" width="173">Hummingbirds</span><br></strong> </b>Are native to the American continent, and one of the smallest in size. Hummingbirds  are very colorful &amp; energetic and belong to the Trochilidae bird species.  Trochilidae comes from the Greek word <em>trochilos,</em> meaning &quot;a small bird.&quot; Their unique ability to rotate their wings in a  circle, makes them the only bird that can fly forwards, backwards, up, down, sideways  and&nbsp;hover in mid air. They could flap their wings 12-90 times per second  (depending on the species). Their English name derives from the characteristic  hum made by their rapid wing beats.<br></td>
		</tr>
		<tr>
<!-- Row Four -->
		<td colspan="3"><b>
		<span class="style3">Feeding</span><br>
		</b>Hummingbirds will feed 5 to 8 times every hour for   30 to 60 seconds at a time. Their main portion of a hummingbirds diet is sugar which they get from flower nectar. Hummingbirds also eat insects   
		to balance their diet which they get protein, amino acids, minerals, &amp; vitamins. 
		The reason why they eat a lot of sugar is to get energy and protein for the 
		muscles. <br><br>Hummingbirds do not spend all day flying, as the energy cost 
		would be prohibitive; the majority of their activity consists simply of sitting 
		or perching. Hummingbirds feed in many small meals, consuming many small 
		invertebrates and up to five times their own body weight in nectar each day. 
		They spend an average of 10-15% of their time feeding and 75-80% sitting and 
		digesting.</td>
		</tr>
		<tr>
<!-- Row Five -->
		<td class="style11" style="height: 142; width: 18%"><strong>
		<img alt="Hum1" class="style9" height="157" src="Hummingbird1.jpg" width="211"></strong></td>
		<td colspan="2" style="height: 142px"><span class="style3"><strong>Flying</strong></span><br>
Hummingbird flight has been studied intensively from an aerodynamic perspective 
using wind tunnels and high-speed video cameras. Writing in <i>Nature</i>, the
biomechanist Douglas Warrick and coworkers studied the Rufous Hummingbird, <i>Selasphorus rufus</i>, 
in a wind tunnel using particle image velocimetry techniques and investigated 
the lift generated on the bird's upstroke and downstroke. They concluded that 
their subjects produced 75% of their weight support during the down-stroke and 
25% during the up-stroke. <br> <br>Many earlier studies had assumed (implicitly 
or explicitly) that lift was generated equally during the two phases of the 
wingbeat cycle, as is the case of insects of a similar size. This finding shows 
that hummingbirds' hovering is similar to, but distinct from, that of hovering 
insects such as the hawk moths.The Giant Hummingbird's wings beat at 8-10 beats 
per second, the wings of medium-sized hummingbirds beat about 20-25 beats per 
second and the smallest can reach 100 beats per second during courtship 
displays.</td>
	</tr>
	<tr>
		<td colspan="3" style="height: 23px">

<!-- Row Six -->
		<span class="style3"><strong>Lifespan</strong></span><br>Hummingbirds, like most 
organisms with very rapid metabolisms, have short life-spans and many die during 
their first year. Those that do survive their first year have an average life 
span of 3 to 4 years.</td>
		</tr>
		<tr>
<!-- Row Seven -->	
		<td class="style4" colspan="3">
		<MARQUEE scrollamount="2" width="50%" class="style7" scrolldelay="30">Hummingbirds are the smallest of all birds!</MARQUEE></td>
		</tr>
		<tr>
<!-- Row Eight -->		
		<td class="style4" colspan="3"><strong>For more 
		informationa about humming birds please visit our source site:<br><br>
		<a href="http://en.wikipedia.org/wiki/Hummingbird">More info</a> </strong></td>
		</tr>
		<tr>
<!-- Row Nine -->			
		<td class="style4" colspan="3"><span class="style6">
		<strong>Contact Us</strong></span><strong><br class="style2">
		<span class="style2">Porwer Marketing</span></strong><br>
		<span class="style2">3299 Cypress ViewDr</span><br class="style2">
		<span class="style2">Ft Lauderdale, FL 33070</span><br class="style2">
		<span class="style2">954-341-9956</span><br class="style2"><span class="style6">
		<strong>Email Us<br></strong></span><span class="style2">Danny Garcia 
		(Webmaster)</span><br><span class="style2">
		<a href="mailto:******@*****?subject=Hummingbirds">GarciaD@hummingbirds.com</a></span></td>
	</tr>
	
</body>
</head>
</html>

Break all those scriptlets out into a Bean or three. Do not use scriptlets in a JSP any more than absolutely necessary (which they never really are). They are nothing but a maintenance nightmare (as you are now experiencing).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.