is there any one to please help me out of this error below
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: 10 in the jsp file: /login.jsp username cannot be resolved to a variable
Below are listed errors along with login.jsp file
login.jsp
<%@ page import="java.sql.*"%>
<%
String userName = request.getParameter("username");
String password = request.getParameter("password");
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://50.62.23.184:3306/gtuser_sched1",
"gtuser_grp1", "capmap");
Statement st = con.createStatement();
ResultSet rs;
rs = st.executeQuery("select * from users where userName='" +username + "' and password='" +password + "'");
if (rs.next()) {
session.setAttribute("userid", userName);
response.sendRedirect("success.jsp");
} else {
out.println("Invalid password <a href='index.jsp'>try again</a>");
}
%>
Exception
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 10 in the jsp file: /login.jsp
username cannot be resolved to a variable
7: "gtuser_grp1", "Capstone1");
8: Statement st = con.createStatement();
9: ResultSet rs;
10: rs = st.executeQuery("select * from users where userName='" +username + "' and password='" +password + "'");
11: if (rs.next()) {
12: session.setAttribute("userid", userName);
13: response.sendRedirect("success.jsp");
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:446)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
note The full stack trace of the root cause is available in the JBoss Web/7.0.10.Final
login.jsp//file where im providing login credentials
<%@ page import="java.sql.*"%>
<%
String userName = request.getParameter("username");
String password = request.getParameter("password");
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://50.62.23.184:3306/gtuser_sched1",
"gtuser_grp1", "capmap");
Statement st = con.createStatement();
ResultSet rs;
rs = st.executeQuery("select * from users where userName='" +username + "' and password='" +password + "'");
if (rs.next()) {
session.setAttribute("userid", userName);
response.sendRedirect("success.jsp");
} else {
out.println("Invalid password <a href='index.jsp'>try again</a>");
}
%>
this is the error displayed
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 10 in the jsp file: /login.jsp
username cannot be resolved to a variable
7: "gtuser_grp1", "Capstone1");
8: Statement st = con.createStatement();
9: ResultSet rs;
10: rs = st.executeQuery("select * from users where userName='" +username + "' and password='" +password + "'");
11: if (rs.next()) {
12: session.setAttribute("userid", userName);
13: response.sendRedirect("success.jsp");
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:446)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
note The full stack trace of the root cause is available in the JBoss Web/7.0.10.Final logs
<!-- begin snippet: js hide: false -->