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

quiz question from jdiscuss

 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following implicit variables should be used by a jsp page to access a resource and to forward a request to another jsp page?

Select 1 correct option.

1>pageContext and config
2>application and config
3>config and pageContext
4>application for both
5>config for both.

Answer is 4.
I havent understood the question. Could someone explain please !
 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application implicit variable is of type javax.servlet.ServletContext, which has the methods- getResource() and getResourceAsStream() to get a resource and getRequestDispatcher() to forward a request.
Although, you can also use 'config' to get ServletContext (and then call the above methods) but it is better to select 'application' because can be used directly.

Found this explaination there itself
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application implicit object represents a handle to the ServletContext. Look up ServletContext and you will see that is has methods for obtaining a Resource (getResource) and a RequestDispather (getRequestDispatcher).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic