1- There is a doGet and doPost in servlet. So how is it possible to use Post and Get at the same time.
I am used to do this in PHP and other web programming languages (sending page selection and action info with URL and form data using Post, then creating pages using MVC pattern) but now I see there are two separate methods and it seems just one of them is being called.
2- Is it possible for example to access Get info from inside doPost method? Or vise versa?
Regards, Mac [ October 21, 2004: Message edited by: Siamak Sarmady ]
Have a look at the Servlet interface. It defines a method called
This is the generic way servlets handle requests. 99% of the time servlets are uses in conjunction with HTTP requests, which have a variety of request types (GET, POST, PUT, HEAD, DELETE, OPTIONS, TRACE). Rather than requiring developers to implement the service method every time with a conditional statement, Sun's developer's added HttpServlet whose service methods does this for you. You could override the service method to handle all requests in the same way if you wanted to, rather than letting it delegate to the appropriate method (however there are differences as to how the different HTTP requests behave in the Java API). Alternatively, an much more easily, you could just get your servlet's doGet method to call doPost, or vice versa.