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!
Asked
Active
Viewed 1,690 times
1 Answers
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
-
How do we call it from an Android application? – Ray Dec 22 '16 at 21:31
-
Please go to this post http://stackoverflow.com/questions/31552242/sending-http-post-request-with-android – Jairo Cordero Dec 26 '16 at 22:40