Results 1 to 8 of 8
- 08-11-2009, 11:40 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
Implicit object in jsp declared where?
I have one question regarding implicit objects in jsp. we can use implicit object in jsp scriptlet without declaring them. it means they are declared somewhere. i wanted to know that in which class/interface these variable declared. one more question, why we are not able to access those variables in declaration part of jsp.:o
Regards,
Mahendra Athneria
Mumbai - India
- 08-11-2009, 11:44 AM #2
implicit objects are available only in jspService method.It will not be available in declaration.Open the java file generated for the jsp and gothru for clarification
Ramya:cool:
- 08-11-2009, 12:17 PM #3
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
thanks Ramya for your quick reply. i got it that there scope is limited to service method only. but my question is that while we are using those variables in jsp they are pre declared, thats why we are able to use them. So where is those variable decalred? what is the location?
- 08-11-2009, 12:27 PM #4
Implicit objects are getting created by the container automatically whenever it generates the servlet code for the jsp and it place the created objects in service method scope.
Ramya:cool:
- 08-11-2009, 12:38 PM #5
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
so u want to say that it is created by the container at the time of translation phase of jsp? if this is the scenario then my doubt is - how we can use those variable prior to the declration, because firstly we use them then it will translated and create the object?
- 08-11-2009, 01:16 PM #6
what do u mean by declaration?
This implicit object is available within <% %> Not for <%! %>.
Whatever actions taking place within scriptlet tag is a service scope.Ramya:cool:
- 08-11-2009, 01:31 PM #7
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
declaration means first decalre the variable then use. im not talking about <%!%> scriptlet.
simple examle-
if i have to use a string varible str, somewhere then firstly i have to declare it. like
String str = new String(); // declaration of str
now i can use str variable.
same in jsp, implicit varible declared some where. as u said it is created inside the servlet when jsp get translated to servlet. so i am asoing ki how we can use those varible in jsp if they are declared after translation phase?
got it or not?
- 08-11-2009, 02:23 PM #8
Similar Threads
-
Class is public, should be declared in a file
By goldhouse in forum New To JavaReplies: 7Last Post: 05-10-2012, 09:17 AM -
Implicit objects
By JavaJunkie in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 05-20-2009, 06:21 AM -
JSP implicit objects
By Java Tip in forum Java TipReplies: 0Last Post: 12-26-2007, 10:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks