page and pageContext are implicit variables.
Page : page is of class java.lang.Object,and it refers to instance of generated servlet.It is declared as
Object page=this;
// this refers to the instance of this servlet
page cannot be used to directly call the servlet methods.
1) <%=page.getServletInfo()%>
Error because page is java.lang.Object type
2) <%=((servlet)page).getServletInfo()%> <----OK:typecast
3) <%=this.getServletInfo()%> <-------OK
PageContext :
-> pageContext is of type javax.servlet.jsp.PageContext.
-> pageContext class is an abstract class.
It does the following things:
1.provide convenience methods to get and set attributes in diff scopes.
2.provide convenience methods for transfering requests to other resources in the web application
void include(String relativeURL) & void forward(String relativeURL)
Ex; pageContext.forward("kiran.jsp");
3.store the references to implicit objects
This comment has been removed by the author.
ReplyDeletePage and Pagecontext are implicit objects in jsp. These are created at JSP translated time. The page object represents the generated servlet instance itself and is used as a scope with in one jsp. Pagecontext is used to initilize all implicit objects for example :- page attributes, access to the request, response and session objects, as well as the JspWriter referenced by out. Refer Servlet And JSP Interview Questions to read servlet and jsp interview questions
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.thanks !!
ReplyDeleteandroid training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training
.Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging
ReplyDeleteweb designing training in chennai
web designing training in velachery
digital marketing training in chennai
digital marketing training in velachery
rpa training in chennai
rpa training in velachery
tally training in chennai
tally training in velachery