• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between Attributes and Parameters

 
Vasiq Molvizadah
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was little bit confused about the difference between an Attribute and Parameters, so I read some posts in this forum and some information from the Head First JSP and Servlet book and here's what I understood...

Attributes are basically used to share some configuration information and they store the data in form of Strings... you can store them in 3 different scopes which are
1. Application / Context scope.
2. Request Scope.
3. Session Scope.

Parameters are basically used to share some information on an application and they store the information in form of Objects....the parameters can be stored in 3 different scopes which are
1. Application / Context scope.
2. Request Scope.
3. Servlet init Scope.

Is there any other difference between attributes and parameters or where you can use them ???

The post from where I got the info about the difference between Attribute and Parameters is http://www.coderanch.com/t/178084/Web-Component-Certification-SCWCD/certification/Parameter-versus-attributes
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Hibernate Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vasiq,
I read that post. I agree with Charles.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
very easy differnece.............

parameter are use to receive the vales from the invoked method...........
like if the message is invoked..
add(int x,int y);
here x and y are receiving valuse when add method is invoked,so they are parameters..........


attributes are used to send actual values when invoking any method...............
like while invoking add(3,4);
here 3 and 4 are actual valuse so they are attributes............
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You;ve got "attributes" -- more properly called scoped variables -- pretty well. But you are way off base on parameters.

Parameters are the way that information is passed from the client to the server as part of submission. They have nothing to do with being stored in any scope.

They are the result of a form submission or a query string on a URL.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shanky sohar wrote:very easy differnece.............

This entire post is not correct -- the subject is request parameters in a Servlet environment, not method parameters and arguments.

And shanky, English sentences conclude with a single period, not a series of 10 of them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic