what is the difference between page and pageContext
implicit variables

Answer Posted / guest

The implicit variable page is of class java.lang.Object and
it refers to instance of generated servlet. It is declared as
Object page=this
Consider
<%= page.getServletInfo() %> will give Error
getServletInfo() is not a method of java.lang.Object
<%= ((Servlet)page).getServletInfo() %> is valid

pageContext variable is of type
javax.servlet.jsp.PageContext. The PageContext class is the
abstract class and JSP engine vendor provides its concrete
subclass.
·Store reference to implicit objects,
·Provide method to get and set attributes in different scopes.
·Provide convenience methods for transferring request to
other resources in web application.
PageContext.forward(“other.jsp”);

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we integrate log4j in Struts2 application?

776


What is the struts in java?

698


What is the difference between struts1 and struts2?

723


how to develop the submit and search operations in single jsp using struts?

2778


What does action do in struts?

735


Difference between struts and spring? Or why use spring, if you are already using struts?

730


How properties of a form are validated in Struts?

741


What is Struts2?

815


Explain how to work with error tags?

800


what is ACID test for fresh engineers??what is the pattern??

2566


Explain struts?

763


What is struts 2 framework in java?

771


What is the purpose of @before annotation?

775


What are interceptors in struts 2?

766


What is the difference between empty default namespace and root namespace?

794