title: HTTP method GET is not supported by this URL -java servlets
body: <p>i am having trouble getting the page to work, what i am doing is when i click the link it should connect to the database and display the data to the browser.</p>
  
  <p>this is my jsp code:</p>
  
  <pre><code>        &lt;html&gt;
          &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  
         &lt;/head&gt;
         &lt;body&gt;
         &lt;%  
            String str = (String)request.getAttribute("acId");
          %&gt;
          Account ID: &lt;a href="detailsservlet"&gt; &lt;%= str %&gt;
         &lt;/body&gt;
         &lt;/html&gt;
  </code></pre>
  
  <p>this is my servlet code:</p>
  
  <pre><code>       package com.Project.Hdfc;
  
         import java.io.IOException;
         import java.io.PrintWriter;
         import java.sql.Connection;   
         import java.sql.DriverManager;
         import java.sql.ResultSet;
         import java.sql.Statement;
  
         import javax.servlet.ServletException;
         import javax.servlet.http.HttpServlet;   
         import javax.servlet.http.HttpServletRequest;
         import javax.servlet.http.HttpServletResponse;
  
  
         public class detailsservlet extends HttpServlet {
  @Override 
  public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
  
  
  
      res.setContentType("text/html");
      PrintWriter pw = res.getWriter();
      Connection con;
      Statement stmt;
      ResultSet rs;
      try{
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con = DriverManager.getConnection("jdbc:odbc:DSN","scott","krishna");
          stmt = con.createStatement();
          rs = stmt.executeQuery("Select * from custm");
          pw.println("Id "+ " Name" +" Address" + "&lt;br&gt;");
          while(rs.next())
          {
          pw.println(rs.getInt(1)+" "+rs.getString(2) + " " + rs.getString(3) + "&lt;br&gt;");
          }
          }
          catch (Exception e){
          pw.println(e);
          }
          }
  
  }
  </code></pre>