import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.net.*; import java.sql.*; public class nimesisestus3 extends HttpServlet{ public void doGet( HttpServletRequest kysimus, HttpServletResponse vastus ) throws IOException, ServletException{ PrintWriter valja=vastus.getWriter(); String isikukood=kysimus.getParameter("isikukood"); String parool=kysimus.getParameter("parool"); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:baasiyhendus1"); Statement st=cn.createStatement(); String lause="SELECT * from inimandmed where (isikukood='" + isikukood + "' and parool='" + parool + "')"; valja.println(lause); ResultSet rs=st.executeQuery(lause); if(rs.next()){ valja.println( "Eesnimi: "+rs.getString("eesnimi") + "
Perekonnanimi: "+rs.getString("perenimi")+ "" ); } else { valja.println("Meldimine ebaġnnestus"); } }catch(Exception viga){ valja.println("Andmete sisestamine ei ġnnestunud"); viga.printStackTrace(valja); } // valja.println("Teie parool on: "+parool+". Valmis"); } }