Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question ID : 995377945515

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following statements correctly store an object associated with a name at a plac where all the servlets/jsps of the same webapp participating in a session can use it?
1)request.setAttribute(name,value)
2)response.setAttribute(name,value)
3)request.getSession().setAttribute(name,value)
4)servlet.getServletContext().setAttribute(name,value)
5)request.setParameter(name,value)
i answered 3 but jwebplus answered 3,4
In 4, what does the servlet mean.
Please clear this.
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would be servletConfig...if so then it is right.
I found so many mistakes in JWeb+ old version. You should check your JWeb+ version..
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
remember that application scope is wider than session scope.
3) getSession().setAttribute(name,value)
servlets/jsps of the same webapp participating in a session can use it..
4) getServletContext().setAttribute(name,value)
not only who participating in session can use it

servlet in 4 is .. HttpServlet
----------------
regards,
alex
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic