import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class Opilased extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/html"); PrintWriter valja=new PrintWriter(vastus.getWriter()); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn= DriverManager.getConnection("jdbc:odbc:inimesed", "", ""); Statement st=cn.createStatement(); String lause="SELECT eesnimi,perenimi FROM opilased;"; ResultSet rs=st.executeQuery(lause); valja.println( "
"); String eesnimi=rs.getString("eesnimi"); valja.println(eesnimi); valja.println(" | ");
valja.println(rs.getString("perenimi")+(" ")); valja.println(" |