I have a java servlet with a URL Query string with instructions like this
http://hostname/servet?param1=value1¶m2=value2
I also structure the doPost/doGet like this
public void doPost(HttpServletRequest req, HttpServletResponse res) {
try {
doGet(req, res);
} catch (Exception e) {
e.printStackTrace();
}
}
public void doGet(HttpServletRequest req, HttpServletResponse res) {
try {
String sParam1 = req.getParameter("param1")
} catch (Exception e) {
e.printStackTrace();
}
}
I can access each queryString parameters via getParameter() for GET actions. But when I attempt to access the same queryString via getParameter() for POST actions, the returned value is NULL.
So, I would like to confirm this behaviour of getParameter for POST and GET actions. That is getParameter does NOT return queryString parameters for POST actions ? And do I need to manually dissect a query string to process them in cases of a POST action ?