import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class Maakonnad extends HttpServlet { public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException { PrintWriter valja = vastus.getWriter(); vastus.setContentType("text/html"); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:AndmeBaas2", "", ""); Statement st22=cn.createStatement(); //###################################################################################### if(kysimus.getParameter("otsimine")!=null){ String maakond=kysimus.getParameter("maakond"); String idee22= "SELECT distinct maakond FROM turism"; ResultSet rs22= st22.executeQuery(idee22); while(rs22.next()){ valja.println(rs22.getString("maakond")); } } cn.close(); }catch(Exception viga){ viga.printStackTrace(valja);} } }