Need help wwith jsp error

Taking a class to learn jsp.  Why I keep getting this error here, http://csci5xx.usc.edu:8860/login.jsp
I don't see any syntax error for the <%@ include...  Please help.  Thanks.

also, what's the best way to set my errMsg for the <span> tag I have.  Javascript?  Thanks.
<%
	String uid=request.getParameter("uid");
	String pw = request.getParameter("pw");
	if(uid == null) uid="";
	if(pw == null) pw="";	
%>

<%@ Include file="loginheader.html" %>

<span id='msg'></span>
<%
	if(uid!="" && pw!="")
	{

		string x='Login information incorrect!';
		//go to database to validate user login%>  
		<p> Validate user</p>
		<!-- Step 1, load the jdbc driver-->
		<% try{
				class.forName("com.mysql.jdbc.driver").newInstance();

		     <//tep 2, Create the Connection object and connect to the sql server

				String connectionString = "jdbc:mySql://server/dbname";
				Connection myConnection = DriverManager.getConnection(connectionString, 'user', 'pass');
				session.setAttribute("myConnection");

			// Step 3, Execut query

					Statement s = null;
					ResultSet rs = null;
					s = myConnection.CreateStatement();
					sqlText = "select * from User where userid = '" + uid + "' and password = '" pw +"'";
					rs = s.ExecutQuery(sqlText);

			if(rs.next)
			{
				String userType;
				userType = rs.getString("userType");					
				if(userType == 1 //Rediret to Admin.jsp	
				{
					session.setAttribute( "uid", uid );
					session.setAttribut("userType", userType);
					session.setMaxInactiveInterval(300);							
					response.sendRedirect("admin.jsp");
				}
				else if(userType == 2 //Redirect to Employee.jsp								
					response.sendRedirect("employee.jsp");
			}
			else
			{
				var errMsg = "Login error!";
			}
			
		}
	%>
 	
<%@ Include file="loginfooter.html" %>

Open in new window

lapuccaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rrzCommented:
<%@ Include file="loginheader.html" %>
try
<%@ include file="loginheader.html" %>
0
rrzCommented:
again
<%@ Include file="loginfooter.html" %>  
try
<%@ include file="loginfooter.html" %>
0
rrzCommented:
>string x='Login information incorrect!';  
try
String x = "Login information incorrect!";
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

rrzCommented:
>session.setAttribute("myConnection");  
Not a good idea.
Just use it and close it when you are finished.  
myConnection.close();  
0
rrzCommented:
Add import if you don't have it already.
<%@ page import="java.sql.* %>
0
rrzCommented:
>if(userType == 1 //Rediret to Admin.jsp      
>else if(userType == 2 //Redirect to Employee.jsp
instead  use  
if("1".equals(userType)) //Rediret to Admin.jsp      
else if("2".equals(userType)) //Redirect to Employee.jsp
bye for now.
0
rrzCommented:
one more
>session.setAttribut("userType", userType);  
session.setAttribute("userType", userType);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lapuccaAuthor Commented:
Hi, I've made the changes you pointed out, except for the close connection. We were instructed to keep it open so we can use it at other pages. Do you think it's better to open it as I need it at each page?
also, now I get new error about, String uid = request.getParameter("uid");
which I can't see the problem either. BTW, it took me a minute or so to realize the include's i was cap.
Thank you.
<%@ page import="java.sql.* %>
<%
	String uid = request.getParameter("uid");
	String pw = request.getParameter("pw");
	if(uid == null) uid="";
	if(pw == null) pw="";	
%>
<%@ include file="loginheader.html" %>

<span id='msg'></span>
<%
	if(uid!="" && pw!="")
	{
		//go to database to validate user login%>  
		<p> Validate user</p>
		<!-- Step 1, load the jdbc driver-->
		<% try{
				class.forName("com.mysql.jdbc.driver").newInstance();

		     <//tep 2, Create the Connection object and connect to the sql server

				String connectionString = "jdbc:mySql://server/dbname";
				Connection myConnection = DriverManager.getConnection(connectionString, 'user', 'password');
				session.setAttribute("myConnection");
				

			// Step 3, Execut query

					Statement s = null;
					ResultSet rs = null;
					s = myConnection.CreateStatement();
					sqlText = "select * from User where userid = '" + uid + "' and password = '" pw +"'";
					rs = s.ExecutQuery(sqlText);

			if(rs.next)
			{
				String userType;
				userType = rs.getString("userType");					
				if(userType == 1 //Rediret to Admin.jsp	
				{
					session.setAttribute( "uid", uid );
					session.setAttribut("userType", userType);
					session.setMaxInactiveInterval(300);							
					response.sendRedirect("admin.jsp");
				}
				else if(userType == 2 //Redirect to Employee.jsp								
					response.sendRedirect("employee.jsp");
			}
			else
			{
				String x = "Login information incorrect!";				
			}
			
		}
	%>
 	
<%@ include file="loginfooter.html" %>

Open in new window

0
lapuccaAuthor Commented:
Thank you.
0
rrzCommented:
>We were instructed to keep it open so we can use it at other pages.
Its ok for testing. But, in real web site with many users, you might have a problem.  
Thanks for the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.