import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class Album extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); 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 autor,kaart FROM postkaart;"; ResultSet rs=st.executeQuery(lause); valja.println( "<==Veebi album==>\n"+ "

Teretulemast veebialbumisse, kuhu saad koguda toredaid pilte, mita netist leidnud oled, ilma kõvaketast saastamata!

\n
"); valja.println(""); valja.println(""); valja.println(""); valja.println(""); valja.println(""); valja.println(""); valja.println(""); while(rs.next()){ valja.println(""); } valja.println("
Pildi autor
Pilt
"); String autor=rs.getString("autor"); valja.println(autor); valja.println(""); valja.println("")+("
")); valja.println("
"); }catch(Exception viga){ valja.println("Probleem andmebaasiga: " +viga); } } }