Multiple choice technology architecture

Which of the following statements are true?

  1. HttpServletRequest getParameter(...) retrieves the parameter value from the request

  2. HttpServletResponse getAttribute(...) retrieves the attribute value from the response

  3. HttpServletResponse getParameter(...) retrieves the parameter value from the response

  4. HttpServletRequest setParameter(...) sets the parameter value to the request

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

HttpServletRequest.getParameter() retrieves request parameter values sent by the client (from query string or POST body). Option B is wrong because HttpServletResponse has no getAttribute() method - attributes are on requests, not responses. Option C is wrong because HttpServletResponse has no getParameter() - parameters belong to requests only. Option D is wrong because HttpServletRequest has no setParameter() method - request parameters are read-only once set by the client.