The Way to Programming
The Way to Programming
// Java Program: Guest Book Application Using Servlets // import java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class guestbk extends httpservlet { Connection con; public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException { PrintWriter out=new PrintWriter(res.getOutputStream()); int ctr=0; res.setContentType("text/html"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:booksrc","",""); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from gbook"); out.println(""); out.println(""); out.println("GuestBook "); out.println(""); out.println("
E-Mail Address | Comment |
"+email+" | "+cmt+" |
Sign in to your account