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.