// Java Document import java.io.*; import java.sql.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class lisa 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(" Lingi lisamine "); out.println(""); out.println(""); String link = kysimus.getParameter("link"); String aadress = kysimus.getParameter("aadress"); out.println("Täname! Sait \"" + link + "\" on lisatud lingi kataloogi.
"); out.println("<< Tagasi lingi lehele "); out.println(""); out.println(""); String paring = "INSERT INTO Lingid (Link, aadress) VALUES ('" + link + "', '" + aadress + "');"; ResultSet rs = st.executeQuery(paring); cn.close(); }catch (Exception viga){viga.printStackTrace();} } }