• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error in jsp page

 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi;
I am developing jsp application for student feedback system. I am using MYSQL as backend. My theme is like:
1.each student will have username and password set by administrator.
2.once user log in particular system it will show various poll topic and accordingly he/she can poll or submit own view.
for that i had created user table in MYSQL DATABE having field emailid as username and password for password. In my validateuserid show the following error(kindly see the comment in rd color)


<%@ page language ="java" %>
<%@ page import="java.sql.*, javax.sql.*, javax.naming.*,java.io.*,java.util.*" %>
<jsp:useBean id="checker" class="com.indiabiznet.igidr.general.PermissionChecker" />
<%
String userid=request.getParameter("userid");
String password=request.getParameter("pass");

InitialContext context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:comp/env/jdbc/mynewdatabase");
Connection conn = ds.getConnection();
context.close();
session.setAttribute("MyConnection",conn);

Logger logger = new Logger(conn);//can not find symbol,class:logger
session.setAttribute("logger",logger);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select UserId from user where emailid='"+userid+"' and password='"+password+"'");
rs.next();
String UserID = rs.getString("UserId");
rs.close();
if (UserID==null )
{
out.println("Invalid User");
session.invalidate();
%>//setaatribute(java.lang.string,java.lang .object)in javax.servlet.http. httpsession can not appied to (java.lang.string,Logger)

<jsp:forward page="/AccessDenied.jsp" />

<%
}
else
{
out.println("Valid User");
}
session.setAttribute("UserID",UserID);


%>
<jsp:forward page="/main.jsp" />

kindly give guidelines for above.
waiting for your valuable suggestion.
thanks and regards
harshal
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kindly help me
regards
harshal
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logger logger = new Logger(conn);//can not find symbol,class:logger

Import class Logger.

second error ll automatically removed , when you correct first one..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!