0

I am running this code

It is giving an error which is out of my understanding

CODE:

<html>
<head>
<title>Login Page</title>
</head>
<body bgcolor="#C0C0C0">
<form method="GET" action="http:\\localhost:8000\login_page.jsp">
<marquee style="font-family:Arial;font-size:14pt;color:#800000;fontstyle:
italic;font-weight:bold">eResource System
-----&gt;The World of Learning</marquee>
<table border="1"width="100%">
<tr>
<td width="18%">
<p><font face="Arial"size="2"color="#800000"><b><a
HREF="home_page.htm">Home</a></b></font></p>
<p><b><font face="Arial"size="2"color="#800000"><a HREF="chart_toppers.jsp">Chart
Toppers</a></font></b></p>
<p><b><font face="Arial"size="2"color="#800000"><a HREF="search_home_page.htm">Search</a></font></b></p>
<p><b><font face="Arial"size="2"color="#800000"><a
HREF="vote_page.jsp">Vote</a></font></b></p>
<p><b><font face="Arial"size="2"color="#800000"><a HREF="download_page.htm">Downloads</a></font></b></p>
<p><b><font face="Arial"size="2"color="#800000"><a HREF="new_release_page.jsp">New
Releases</a></font></b>
<p><font face="Arial"size="2"color="#800000"><b><a HREF="register_page1.htm">Register</a></b></font>
<p><font face="Arial"size="2"color="#800000"><b><a HREF="help_page.htm">Help</a></b></font></p>
<p>&nbsp;</td>
<td width="82%"valign="top">
<%! String username;%>
<%! String password;%>
<%! String role;%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.text.*"%>
<%@ page import="java.sql.Date"%>
<%@ page language="java"%>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connect;
connect=DriverManager.getConnection("jdbc:odbc:EResouceDB","","");
Statement state;
state=connect.createStatement();
String strQuery1="select Password, Role from Login_Info where User_name='"+username+"'";
username=request.getParameter("username");
password=request.getParameter("password");
ResultSet result1=state.executeQuery(strQuery1);
String pass;
String user="user";
while(result1.next())
{
pass=result1.getString("Password");
role=result1.getString("Role");
role=role.trim();
if((pass.equals(password))&&(role.equals("user")))
{
role="user";
session.setAttribute("username",username);
}
else if
((pass.equals(password))&&(role.equals("admin"))) role="admin";
else
role="no_user";
}
}
catch(Exception e){
out.println("doneexception"+e);
}
role=role.trim();
if(role.equals("user")){%>
<jsp:forward page="user_home_page.jsp"/>
Vector vc=new Vector(1,1);
session.setAttribute("Shopping_List",vc);
<%}
else if(role.equals("admin")){
%>
<jsp:forward page="admin_home_page.htm"/>
<%}
else
out.println("<p><fontface=\"Arial\"size=\"2\" color=\"#800000\"><b>You have entered incorrect logon information. Please enter correct logon details.</b></font></p>");
%>
<p><font face="Arial"size="2"color="#800000">Please enter your logon details.</font></p>
<p><font face="Arial"size="2"color="#800000">User Name:</font><input type="text"name="username"size="20">
</p>
<p><font face="Arial"size="2"color="#800000">Password:</font>&nbsp;&nbsp;<input type="text"name="password"size="20"></p>
<p><font face="Arial"size="2"color="#800000">New User?<a HREF="http://localhost:8000/Register/RegisterPage.htm">Register</a></font></p>
<p align="center"><input type="submit"value="Submit"name="B1"><input
type="reset"value="Clear"name="B2"></p>
<p>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>
</body>
</html>

Error:

Error #: 204 : illegal start of expression
Error #: 206 : malformed expression

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by __avd
0
....
if(role.equals("user")){
   %>
	<jsp:forward page="user_home_page.jsp"/>
  <%
	Vector vc=new Vector(1,1);
session.setAttribute("Shopping_List",vc);
  }
else if(role.equals("admin")){
   %>
<jsp:forward page="admin_home_page.htm"/>
<%}
else
out.println("<p><fontface=\"Arial\"size=\"2\" color=\"#800000\"><b>You have entered incorrect logon information. Please enter correct logon details.</b></font></p>");
%>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.