Difference between getAttribute() and getParameter()

  • getParameter() returns http request parameters. Those passed from the client to the server. For example http://example.com/servlet?parameter=1. Can only return String

  • 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.

Leave a Comment

tech