// Java Document import java.io.*; import java.sql.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class hinda 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(" Hindamine "); out.println(""); out.println(""); int saidi_id = Integer.parseInt(kysimus.getParameter("id")); int hinne = Integer.parseInt(kysimus.getParameter("hinne")); out.println("Hindasid seda saiti " + hinne + "-ga!
"); out.println("Täname hindamast!
"); out.println("<< Tagasi lingi lehele "); out.println(""); out.println(""); String paring = "INSERT INTO hinded (lingi_id, hinne) VALUES ('" + saidi_id + "', '" + hinne + "');"; ResultSet rs = st.executeQuery(paring); cn.close(); }catch (Exception viga){viga.printStackTrace();} } }