import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class AB1 extends HttpServlet{ public void doPost(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ doGet(kysimus, vastus); } public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/html"); PrintWriter valja=new PrintWriter(vastus.getWriter()); String t1 =kysimus.getParameter("isikukood"); String t2 =kysimus.getParameter("eesnimi"); String t3 =kysimus.getParameter("perenimi"); String t4 =kysimus.getParameter("tanav"); String t5 =kysimus.getParameter("maja"); String t6 =kysimus.getParameter("linn"); try{ if (t1 !=null & t2 !=null & t3 !=null & t4 !=null & t5 !=null & t6 !=null){ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");// Connection cn=DriverManager.getConnection("jdbc:odbc:proov2", "", ""); Statement st=cn.createStatement(); String lause="INSERT INTO inimesed (IK, eesnimi, perenimi, linn, maja, tanav)"+ "values ('"+t1+"','"+t2+"','"+t3+"','"+t4+"','"+t5+"','"+t6+"');"; st.executeUpdate(lause); cn.close(); } }catch(Exception e){e.printStackTrace(valja);}//kuvatakse veateated valja.println(""+ "
"+ "