• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between getAttribute(string) and getParameter(String)

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,
i come to know how get Parameter method works.....In that,

1)when we submit the form without fields value(empty form) ,will the value is null or empty?

please explain me about get Attribute method..i am not clearing of this..
 
Ranch Hand
Posts: 136
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. When you use getParameter() method and send it as empty you will get Null pointer exception since null values are retrived.

And the difference between getParameter() and getAttribute() is ,In getParameter you can retrive the values of the form.

Say you have


In the above code you can see the name="user1" this the key for us to take the user name type by the user. In next page you can get it as



Now you will get the user name typed by user.


For getAttribute(),

If you have a string value in a page and you want to take it to next page that time we use getAttribute(). It will get the value from previous page as session

Say ,



Now in next page you will get the session as,



This is the difference ... Check the bold words for exact difference to say in one word


 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic