1

Am I able to create an object of the servlet and call the post method and pass the required arguments or do I have to declare it inside the web.xml and if I do declare it inside the web.xml file, do I still have to create an object from the servlet, how does this work? Im trying to use Google Cloud Storage, I already compiled the dependency in one of my modules, I also have the servlet class provided by google. thank you!

SteelToe
  • 2,477
  • 1
  • 17
  • 28
Ray
  • 29
  • 1
  • 7

1 Answers1

0

When you create a servlet, it comes with two common methods, GET & POST

public class DemoServlet extends HttpServlet{  
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException  {

    }

    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {

    }

}

The easy way of calling a post method from html page is:

<form action="/servlet" method="POST">
  <input type="hidden" name="q" value="a">
</form>
Jairo Cordero
  • 640
  • 6
  • 8