I try to extract the form data from an javax.servlet.http.HttpServletRequest
instance. As recommended online I tried request.getParameter(String paramKey)
, but it did not work. request.getParameterValues()
, request.getParameterNames()
and request.getParameterMap()
return no form data as well. What I want is a Map with form data or another method to get them.
it will behave where you write the code request.getParameter(). this thing always needs to write in the doGetPost() Method of the servlet like mentioned below. refer the following example.
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String id = req.getParameter("realname");
String password = req.getParameter("mypassword");
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String id = req.getParameter("realname");
String password = req.getParameter("mypassword");
}