• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custom tag mock exam question

 
rehans oberoi
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • 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
 
Priya Jothi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct options - 2,3,4.

Regards,
Priya.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


Even 4th looks correct.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic