Forums Register Login

implicit object "page"

+Pie Number of slices to send: Send
Hi,


page(Object) The instance if this page's implementation class. If the
scripting language is java (i.e. the page directive has the attribute
language="java"), this is equivalent to using the this keyword in scripting expressions.



I miss to understand the use of page implicit object and specially what
if we don't have page directive that has attribute language="java".

Any help please!

Thanks,
+Pie Number of slices to send: Send
 

if we don't have page directive that has attribute language="java".


It's a bit of a mistery, as there's no other scripting language available yet ! Actually, "java" has become mandatory in the new JSP2.1 specification (the specification for SCWCD is 2.0). So don't worry much about that. Just remember that "page" works like "this".
+Pie Number of slices to send: Send
Thanks Christophe,

Does this mean, the above content was regarding specification 2.1?
And we have page implicit behavior as "this" without having page directive
with language attribute with "java" value.



Thanks,
+Pie Number of slices to send: Send
 

Does this mean, the above content was regarding specification 2.1?


No, sorry to confuse you. The above content is about 2.0. I wanted to say that you'll probably never see anything other than "java" as being the language used. So you can consider "page" to be "this".
+Pie Number of slices to send: Send
Alright!

As I understood, "java" is the only value for language attribute of the page
directive. But is it like, if we don't write <%@page language ="java"%> we
wont have access to page implicit object?


Thanks,
+Pie Number of slices to send: Send
1. The default value is "java" so, it's ok if you don't set it in the page directive.
2. In JSP 2.0, the only defined and required scripting language value for this attribute is "java". So if you try to set it to something else, you'll probably get an exception from your container. I've never tried it.
+Pie Number of slices to send: Send
 


But is it like, if we don't write <%@page language ="java"%> we
wont have access to page implicit object?



I dont think it will be that way chandra. Even if you miss out the language attribute, the page implicit object should be accessible.

As per the spec of JSP 2.0, (Section 1.10.1 The page Directive)

  • Only permissible value for the language is "java"
  • even if the language attribute to the "page" directive is missed out, its considered to have "java" - means, its the default value.
  • If any other non-java language attribute is used in the "page" directive, its a fatal error



  • As per the spec of JSP 2.0, (Section 1.8.3 Implicit Objects),
  • Variable Name : page
  • Variable Type : java.lang.Object
  • Semantic & Scope : The instance of this page's implementation class processing the current request page scope.


  • When the scripting language is java then page is a synonym for this in the body of the page


    With the above points, even if you dont specify any language for the page directive, as "java" is considered by default, you will definitely have access to the "page" implicit object.

    HtH.
    +Pie Number of slices to send: Send
    Very Nice Raghavan!

    I got it very well.

    Thanks,
    [ July 20, 2007: Message edited by: Chandra Bhatt ]
    Always look on the bright side of life. At least this ad is really tiny:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 789 times.
    Similar Threads
    valid implicit variables in a JSP
    IsError Page in jsp
    Cannot print exception message
    Regarding session in JSPs, a question from Enthuware Mock Exam
    using isErrorPage page Directive PRoblem
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 29, 2024 07:52:16.