import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class inimesed extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter(vastus.getWriter()); valja.println("\n"+ ""+ "Inimesed"+ "\n" ); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn= DriverManager.getConnection("jdbc:odbc:java", "", ""); Statement st=cn.createStatement(); String lause="SELECT * FROM klient;"; ResultSet rs=st.executeQuery(lause); valja.println( "Haapsalu elanikud"+ ""+ " "+ " "+ " "+ " "+ " "+ " "+ " " ); while (rs.next()){ valja.println("\n"+ "\n"+ "\n"+ "\n"+ "" ); } cn.close(); valja.println("
PerenimiEesnimiTänavMajaKorter
"+rs.getString("Perenimi")+""+rs.getString("Eesnimi")+""+rs.getString("Tanav")+""+rs.getString("Maja")+""+rs.getString("Korter")+"
\n"); }catch(Exception viga){ valja.println("\n"); } } }