Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Implicit Objects  RSS feed

 
Krishna Tota
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Please explain this in brief:

We generally call request,responce,page,application,out etc these as Implicit Objects.

I want to know what are Implicit variables and implicit methods.

Please replay.
Thanks,
Krishna
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krishna,

implicit objects usually are implicit because there's no extra effort for the programmer to use them. For example the implicit objects you mentioned are automatically provided by the servlet container (Tomcat) if you run a web application with JSP.

But implicit variables and methods doesn't sound like a common term to me. In which context did you hear or read about it?

Marco
 
Shashi Kant
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krishna,

There are total 9 implicit variables, that are available to jsp page. viz application, session, request, response, out, page, pageContext, config, exception.
Because the page author does not(and can not) declare these variables explicitly, they are called implicit variables. The objects that these variables refer to are created by the servlet container and are called implicit objects.
ex.


Even though we have not defined the variable out in this example, the code will translate, compile and execute without errors. This is because out is one of nine variables that the JSP engine implicitly makes available to the JSP page.

Hope this clears your idea about implicit objects. :thumb:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!