Servlet HTTP Request Parameters Example

In the previous post, you are similar to the Servlet Context Parameter Example. This tutorial will show you how to build servlet HTTP request parameters example. The HTTP request parameters are passed along with the request. The HTTP request parameters could be passed by two ways. One way is sent as part of the URL and another way is sent as part of of the body of an HTTP request. This is fifth post of series of Java Servlet Tutorial. This series tutorial will provide you full knowledge about Servlet 3.0.

Servlet HTTP Request Parameters The request.getParameter() method is used to get the HTTP request parameters from the request and returns a string or return null if the parameter doesn’t exist. We can also get an array of parameters with request.getParameterValues() which returns an array of strings.

The URL is without parameters: http://localhost:8080/servlet-param/param We will not receive any Servlet HTTP Request Parameters, here is the result.

The URL is with parameters: http://localhost:8080/servlet-param/param?username=javabycode&password=123&profileArray=US&profileArray=California We will receive all Servlet HTTP Request Parameters, Here is the result