getAttribute() and getParameter()
getParameter()
returns http request parameters. Those passed from the client to the server. For examplehttp://example.com/servlet?parameter=1
. Can only returnString
getAttribute()
is for server-side usage only - you fill the request with attributes that you can use within the same request. For example - you set an attribute in a servlet, and read it from a JSP. Can be used for any object, not just string.