What is the difference between attribute and parameter?

An attribute is an object which can be bounded into three other servlet objects- HttpServletRequest, HttpSession, ServletContext.
You can think of it as a name value pair where name is String and value is Object. It can have three types of scope- context,request,session

Remember attributes are not parameters:
In attribute you can share an object but in case of parameter you can share a string.
For setting attribute the method setAttribute() is used but for parameter there is no method, should be set in the DD.
The return type of attribute(getAttribute()) is Object but for parameter(getInitParameter()) it is String.


  1. Try not to become a man of success, but rather try to become a man of value. See the link below for more info.


  2. Good day! I was so impressed to see a very well-presented dishes that is absolutely tasty
    and delicious. You've done a great job.Well, thank you for sharing your talent and article
    it is very well appreciated. You can also visit my site if you have time.