import java.io.*; import java.sql.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class VapraLisamine extends HttpServlet { public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException { try{ ResourceBundle rb = ResourceBundle.getBundle("LocalStrings",kysimus.getLocale()); vastus.setContentType("text/html"); PrintWriter out = vastus.getWriter(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:Baas1"); Statement st=cn.createStatement(); out.println(""); out.println(""); out.println(" Uue laulu lisamine "); out.println(""); out.println(""); out.println(""); String laul = kysimus.getParameter("laul"); String esitaja = kysimus.getParameter("esitaja"); out.println("

Täname! Laul \"" + laul + "\" on lisatud hindamiseks.

"); out.println("

<< Tagasi edetabelisse

"); out.println(""); out.println(""); String paring = "INSERT INTO vaprad (laul, esitaja) VALUES ('" + laul + "', '" + esitaja + "');"; ResultSet rs = st.executeQuery(paring); cn.close(); }catch (Exception viga){viga.printStackTrace();} } }