[JAVA] getParameter method

I am a Java beginner. This time, I will output about the getParameter method.

Q1: What is 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

How to use getParameter method?

** 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.

Notes on getParameter ()

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

getParameter method
Method
Java method
to_i method
java (method)
getRequestDispatcher () method
Map method
include method
Abstract method
initialize method
List method
puts method
Java method
Class method
save! method
[Java] method
private method
rails method
[Java] method
Ruby to_s method
Screen transition method
Binary search binary search method
Method to search
Factory Method Pattern
Exception switching method
RxSwift method chain
Rails delegate method
scan method problem
[Ruby] slice method
[Ruby] end_with? method
[Ruby] Method memorandum
[HTTP method PATCH]
About the method
[Java] forEach method
[Practice] Map method
variable and method
Template Method pattern
Template Method Pattern
0-filled (non-zero) method
JavaSilver11 study method
keycloak test-skip method
Factory Method pattern
[Ruby] initialize method
Ruby build method
undefined method `** _ path'error
java8 method reference
[Java] Random method
Ruby accessor method
[Java] split method
ruby map method