Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doStartTag() question

 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following code for the doStartTag() method of a Tag:

public void doStartTag()
{
if(somecondition)
{
return IterationTag.EVAL_BODY_INCLUDE;
}
else
{
LINE 1://forward the request to page2.jsp
}
}
Which of the following lines of code can be placed at LINE 1 above, so that the request can be forwarded to page2.jsp?




Select 1 correct option.
a RequestDispatcher rd = request.getRequestDispatcher("page2.jsp");  rd.forward(request, response);


b pageContext.forward("page2.jsp");


c RequestDispatcher rd = pageContext.getRequestDispatcher("page2.jsp");  rd.forward(request, response);


d request.forward("page2.jsp");


e None of these.

is the right answer will be 'a'?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you ask yourself "where does request come from ?"
 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so 'e' will be the right one?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say "e", as we don't know if this is a TagSupport. TagSupport has a pageContext attribute which can be used to forward to another page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic