• 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

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic