title: Unable to compile class for JSP: nme cannot be resolved
body: <p>I am trying to connect JSP with MYSQL Server 5.1.49 using TOMCAT 6.0.
  I am able to connect JAVA with MYSQL but unable to configure mysql with tomcate and getting below error </p>
  
  <pre>
  org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
  An error occurred at line: 54 in the jsp file: /checlLogin.jsp
  nme cannot be resolved
  51:     String pwd = request.getParameter("password");
  52:     String uName = request.getParameter("username");
  53: 
  54:      if(nme.equals(uName))
  55:       {
  56:         response.sendRedirect("index.jsp");
  57:       }
  </pre>
  
  <pre><code>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:439)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
   org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  </code></pre>
  
  <p>Can anyone kindly explain what I am doing wrong.</p>
  
  <hr>
  
  <p><strong>Update</strong>: Here is my Code: <code>CheckLogin.jsp</code></p>
  
  <pre><code>&lt;%@ page language="java" import="java.sql.*" errorPage=""%&gt;
  &lt;%@ page import="java.util.*"%&gt;
  
  
  &lt;%
     Connection con = null;
     try {
     Class.forName("com.mysql.jdbc.Driver").newInstance();
     con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "sohail");
     if(!con.isClosed())
     System.out.println("Successfully connected to MySQL server...");
  
  //Step 5: create Statement
  Statement st = con.createStatement();
  
  //Step 6: preapare &amp; execute the query
  String sql = "SELECT * FROM login";
  ResultSet rs = st.executeQuery(sql);
  
  //Step 7: process the results
  while(rs.next())
  {
  String nme = rs.getString("loginID");
  String pwd = rs.getString("password");
  System.out.println(nme + " " + pwd);
  }
  //Step 8: close the connection
  
  con.close();
  
  } 
  catch(Exception e) 
  {
  System.err.println("Exception: " + e.getMessage());
  } 
  finally 
  {
  
  try 
  {
  
  if(con != null)
  
  con.close();
  
  } 
  catch(SQLException e) 
  {
  } 
  }
  
      String pwd = request.getParameter("password");
      String uName = request.getParameter("username");
  
       if(nme.equals(uName))
        {
          response.sendRedirect("index.jsp");
        }
        else{
       response.sendRedirect("index.jsp");
        }
  %&gt;
  </code></pre>
  
  <p>Thanks for your further explaination to fix this issue.</p>