• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

quiz question from jdiscuss

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Let's go to the waterfront with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic