import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class AlbumLisa extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter(vastus.getWriter()); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn= DriverManager.getConnection("jdbc:odbc:inimesed", "", ""); Statement st=cn.createStatement(); //String lause="SELECT autor,kaart FROM postkaart;"; //ResultSet rs=st.executeQuery(lause); valja.println( "<==Veebi Album==>\n"+ "

Lisamiseks täida allolevad väljad

\n"); valja.println(""); valja.println(""); valja.println("
"); valja.println("
"); valja.println(""); //String pilditegija=kysimus.getParameter("pildiautor"); //String pildiURL=kysimus.getParameter("URL"); valja.println(""); //String lause2="INSERT INTO postkaart (autor,kaart) values ('zebra', 'http://www.tpu.ee/~zebra/auto.jpg')"; //String lause2="INSERT INTO postkaart (autor, kaart) values ('"+pilditegija+"', '"+pildiURL+"')"; //st.executeUpdate(lause2); // cn.close(); valja.println("
"); }catch(Exception viga){ valja.println("Probleem andmebaasiga: " +viga); } } }