Question - Explain Request parameters associated with servlets.
Answer -
There can be any variety of request parameters related to the servlet with every access to it. These parameters are usually [name-value] pairs that give the servlet any further information that it desires so as to handle the request.
An HTTP servlet gets its request parameters as a part of its query string or as encoded post data. A servlet used as a server-side includes its parameters equipped with PARAM tags.
Fortunately, although a servlet will receive parameters in an exceeding variety of various ways, every servlet retrieves its parameters the same way, by using getParameter() and getParameterValues() :
- public String ServletRequest.getParameter(String name)
- public String[] ServletRequest.getParameterValues(String name)