• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between getParameter() and getAttribute()

 
Basavaraj Reddy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

can i know wat's the difference between getParameter() and getAttribute()
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the javadocs?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Basavaraj,

Welcome to Java Ranch , check this. before posting your questions show some efforts if you still not able to find the answer million people are there to help you.

I hope this helps.
 
Jayavardhan geepi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 difference I know.

getParameter() always returns "String".
getAttribute() always returns type "Object". So, if you had setAttribute of type XXX, you have to cast it back while getting it.
 
dileep keely
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give a try in knowing what exactly a parameter is and attribute ?that should solve your problem
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to javaRanch.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Basavaraj.

Are you studing web components? Do you have any material?

I would indicate to your Head First Web Components. It's a good book, you will lear those diferences.

Welcome to Javaranch!
 
eric totte
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few differences..

Attributes can be used for communication between servlets. They store data in name value pairs, and can be get/set.
Parameters are bits of information from the client, they cannot be set.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic