If you want an href to post data to a server, you will probably need create a javascript onclick event to submit a form so when you click on the link, the event will cause a form submit. Of course the form must use the POST method.
<A href="myServlet" onClick='document.myForm.submit();'>Post data</A>
If you just want the servlet to take the GET but do a POST, it would be something like this:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doPost(request, response);
}
Originally posted by triveni sangam:
HI,
If I click on a link, it will call a servlets get method. How can I make it call the post method of the servlet. In other words, if i click a href, it should call the doPost method instead doGet method of the servlet.
Thanks,
Javed.