title: Missing IN or OUT parameter at index:: 3
body: <p>I am new in programming world. I tried to make a simple login however, I  getting this error: </p>
  
  <blockquote>
    <p>missing IN or OUT parameter at index:: 3</p>
  </blockquote>
  
  <p>I've tried to find the answer but I still can't recognize the problem in my coding.</p>
  
  <p>Here is my LoginServlet</p>
  
  <pre><code>package apl;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.RequestDispatcher;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
  import apl.LoginDao;
  
  
  public class LoginServlet extends HttpServlet{
  
      private static final long serialVersionUID = 1L;
  
      public void doPost(HttpServletRequest request, HttpServletResponse response)  
              throws ServletException, IOException {  
  
          response.setContentType("text/html");  
          PrintWriter out = response.getWriter();  
  
          String i=request.getParameter("sid");  
          String n=request.getParameter("sname");
          String p=request.getParameter("sphone");  
          String u=request.getParameter("susername");  
          String w=request.getParameter("spassword");
  
  
          HttpSession session = request.getSession(true);
          if(session!=null)
          session.setAttribute("sid", i);
  
          if(LoginDao.validate(i,n,p,u,w)){  
              RequestDispatcher rd=request.getRequestDispatcher("welcome.jsp");  
              rd.forward(request,response);  
          }  
          else{  
              out.print("&lt;p style=\"color:red\"&gt;Sorry username or password incorrect&lt;/p&gt;");  
              RequestDispatcher rd=request.getRequestDispatcher("login.jsp");  
              rd.include(request,response);  
          }  
  
          out.close();  
      }  
  } 
  </code></pre>
  
  <p>Here is my LoginDao</p>
  
  <pre><code>package apl;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  
  public class LoginDao {
  
          public static boolean validate(String sid, String sname, String sphone, String susername, String spassword) {  
  
              boolean status = false;
              Connection conn = null;
              PreparedStatement pst = null;
              ResultSet rs = null;
  
              String driver = "oracle.jdbc.driver.OracleDriver";
  
              try {
                  Class.forName(driver).newInstance();
                  conn = DriverManager
                          .getConnection("jdbc:oracle:thin:@localhost:1521:xe","apl","system");
  
                  pst = conn.prepareStatement("select * from SELLER where sid=?,sname=?,sphone=?,susername=? and spassword=?");
  
                  pst.setString(1, sid);              
                  pst.setString(2, sname);                
                  pst.setString(3, sphone);
                  pst.setString(4, susername);
                  pst.setString(5, spassword);
  
  
                  rs = pst.executeQuery();
  
                  status = rs.next();            
  
  
              } catch (Exception e) {
                  System.out.println(e);
              } finally {
                  if (conn != null) {
                      try {
                          conn.close();
                      } catch (SQLException e) {
                          e.printStackTrace();
                      }
                  }
                  if (pst != null) {
                      try {
                          pst.close();
                      } catch (SQLException e) {
                          e.printStackTrace();
                      }
                  }
                  if (rs != null) {
                      try {
                          rs.close();
                      } catch (SQLException e) {
                          e.printStackTrace();
                      }
                  }
              }
              return status;    
          }
      }
  </code></pre>
  
  <p>Here is my jsp file</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Login Application&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="LoginServlet" method="post"&gt;
          &lt;fieldset style="width: 300px"&gt;
              &lt;legend&gt; Login to App &lt;/legend&gt;
              &lt;table&gt;
                 &lt;tr&gt;
                      &lt;td&gt;Id&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="sid" required="required" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Password&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="sname" required="required" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Phone&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="sphone" required="required" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;User name&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="susername" required="required" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Password&lt;/td&gt;
                      &lt;td&gt;&lt;input type="password" name="spassword" required="required" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;input type="submit" value="Login" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;apl.LoginServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/LoginServlet&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;login.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  </code></pre>