I am a Java beginner. This time, I will output about the getParameter method.
A: It is a method ** to get the data sent from the form on the client side from the objects of the "HttpServletRequest" interface **.
The part in bold above is called the request parameter
** Request parameters are sent in "name" and "value" pairs **
sample.java
request.getParameter("HTML name attribute value");
By setting the HTML name attribute value, you can get the value of the value attribute written as a set with the name attribute.
All the values obtained by getParameter will be ** String **.
What if you want an int type or someone else? You may think that.
If you want to make it int type
You can make it a number with ʻInteger.parseInt () .
(Example) Integer.parseInt (request.getParameter ("HTML name attribute value "));`
As mentioned above, it is possible to convert to other types, so please convert to the required type according to the situation.
Recommended Posts