• 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

setParameter() and setAttribute()

 
Ranch Hand
Posts: 232
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Folks,
Normally, getParameter() and setParameter() are used to retrieve information posted by a form using GET/POST.Information posted with form can be retrieved with getAttribute.BUT ONLY if the information is explicitly put in objects like request, pagecotext etc using "setAttribute", then we MUST use "getAttribute" NOT *getParameter". I believe information put in these objects with "setAttribute" and "setParameter" are different and eventhough are placed in the same object.Now my question is WHAT is the situation WHERE "setAttribute" is required instead of "setParameter"? and we can't use "setParameter" at all but "setAttribute"? I would appreciate if you could point out clearly.
thanks.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no setParameter() method.

getParameter() is used to retrieve submitted parameter values, be they from a form submission or retrieved from the query string of a URL.

setAttribute() and getAttribute() are used to get and retrieve scoped variables from the page, request, session and application contexts.

They are completely different concepts.
 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Originally posted by Bear Bibeault:
There is no setParameter() method.

getParameter() is used to retrieve submitted parameter values, be they from a form submission or retrieved from the query string of a URL.

setAttribute() and getAttribute() are used to get and retrieve scoped variables from the page, request, session and application contexts.

They are completely different concepts.



So getParameter() can't be used to get the scoped variables? WHY? because there's not setParameter?

How is parameter different than attribute? specific situation each one is required? thanks.
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Carn Melon:

So getParameter() can't be used to get the scoped variables? WHY? because there's not setParameter?


Why do you need two methods to do the same action?


How is parameter different than attribute? specific situation each one is required? thanks.


parameters are String values bound to String names(keys), are set by the J2EE server, from the HTTP request sent by the browser.
An attribute can be any object bound to a String name(key), you have to explicitly bind it or unbind it.

Have a look at
J2EE API, a programmer's best friend
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic