title: servlet request.getParameter cannot be resolved
body: <p>The following is a servlet for getting parameter from a jsp page.</p>
  
  <p>I am trying to run following code --</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.swing.JFrame;
  
  
  public class oneServlet extends HttpServlet {
  
  public static Connection getConnection() throws Exception {
  
      String driver = "org.postgresql.Driver";
      String url = "jdbc:postgresql://10.1.11.112:5432/pack";
      String username = "pack";
      String password = "pack";
      Class.forName(driver);
      Connection conn = DriverManager.getConnection(url, username, password);
      return conn;
  }
  
  public static void main(String[] args) throws Exception {
      String user=request.getParameter("t1");
      String pass=request.getParameter("t2");
      Connection conn = null;
      PreparedStatement pstmt = null;
      try {
          conn = getConnection();
          String queryTest = "select username,password from login";
          pstmt = conn.prepareStatement(queryTest);
  
          ResultSet rs = pstmt.executeQuery();
          while (rs.next()) {
           String username=rs.getString(1);
           String password=rs.getString(2);    
  
     if(user.equals(username) &amp;&amp; pass.equals(password))
         {
  
       JFrame frame = new JFrame("/LoginSuccess.jsp");
  
         }    
          else
          {
  
              System.out.println("Login Failed,Please try Againe");
          }
          }}
  
       catch (Exception e) {
          e.printStackTrace();
      } finally {
          pstmt.close();
          conn.close();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>It's showing error in request.getParameter that " request cannot be resolved. Can anyone help me resolve this.</p>