import javax.servlet.*; import javax.servlet.http.*; import java.text.*; import java.io.*; import java.sql.*; public class lisamuuzik extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter(vastus.getWriter()); String esitaja=kysimus.getParameter("esitaja"); String lugu=kysimus.getParameter("lugu"); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn= DriverManager.getConnection("jdbc:odbc:andmed", "", ""); Statement st=cn.createStatement(); if (esitaja==null && lugu==null){ } else{ String lause="INSERT INTO muuzik (esitaja , lugu) values ('"+esitaja+"', '"+lugu+"');"; st.executeUpdate(lause); } String lause="SELECT esitaja, lugu, keskmine, id FROM muuzik"; ResultSet rs=st.executeQuery(lause); valja.println("
Bänd | "+ "Lugu | "+ "