• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

custom tag mock exam question

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
given

public class MyTagHandler extends TagSupport
{

public int doStartTag()
{
// insert code here
// return an int

}
// more code here
......

}


there is single attribute foo in the session scope
which three code fragments inserted independently at line 5 ,
return the value of the attributes ( choose three )

1. Object o = pageContext.getAttribute(" foo");
2. Object o =pagecontext.findAttribute("foo");
3. Object o =pagecontext.getAttribute("foo , PageContext.SESSION_SCOPE);
4. httpsession = pagecontext.getSession();
Object o =s.getAttribute("foo");
5.HttpServletRequest r = pageContext.getREquest();
Object o = r.getAttribute("foo");


my answer 2,3 , ?

hi ranchers
what is right answer
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct options - 2,3,4.

Regards,
Priya.
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


4. HttpSession s = pagecontext.getSession();
Object o = s.getAttribute("foo");



Even 4th looks correct.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic