2017  Kodetalk | Feedback | Privacy Policy | Terms | About

What is the difference between getAttribute() and getParameter() ?

What is the difference between getAttribute() and getParameter() methods within HttpServletRequest class?

getParameter() returns Http request parameters that are passed from the client to the server.

For example http://example.com/servlet?parameter=1. It can only return String

getAttribute() is used at the server-side usage only - you can fill the request with attributes that you can use within the same request. It can be used for any object, not just string.

Answer is