Hello friends i am trying to create a login web page application check out this code it will show an error like this...
.

```
java.sql.SQLException: No data found
        at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
        at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
        at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
        at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
        at LoginServlet.doPost(LoginServlet.java:26)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:306)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:161)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:108)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:379)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso
r.java:282)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr
ocess(Http11AprProtocol.java:357)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:1687)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Exception caught

```

Code goes here..........

```
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class LoginServlet extends HttpServlet
{
    Connection con;
    public void doPost(HttpServletRequest hreq,HttpServletResponse hres) throws ServletException,IOException
    {
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con=DriverManager.getConnection("jdbc:odbc:mohit","system","rock");
            PreparedStatement ps=con.prepareStatement("select pswd from signup where username=?");
            ps.setString(1,hreq.getParameter("t1"));
            ResultSet rs=ps.executeQuery();
            if(rs.next())
            {
                boolean b=(rs.getString(1)).equals(hreq.getParameter("t2"));
                System.out.println(rs.getString(1));
                System.out.println(hreq.getParameter("t2"));
                System.out.println(b);
                if(b)
                {
                    hres.sendRedirect("./success.html");
                }
                else
                {
                    hres.sendRedirect("./error.html");
                }
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.println("Exception caught ");
        }
    }
}

```