Jsp Implicit Objects:-
Introduction about JSP's:-
1) Jsp is used to develop web based applications
2) Jsp's are used as alternative to servlets
3) Generally we place Jsp's programs inside the project folder outside the WEB-INF folder extension of JSp program must be .Jsp
4)we are created the following JSP
5) To set the above JSp we use the following URL
htttp://localhost:9000/projectname/one.jsp
Every server uses a cache folder to do a temporary work incase of tomcat it uses work as a cache folder
Advantages of Jsp:-
1) Jsp improve productivity of the developer (delivey the project quickly to the customers)
2) We can develop Jsp's without the knowledge of Java
3) Jsp's are used to seperate out business logic and presentation logic
4) Every server will have a cache memory. In case of tomcat work folder is acting as cache
5) Jsp is an automatically develop servlet. This servelt is generated by the server
6) Apache corporation as released so many projects we use apache HTTP server to run static web based applications HTTP server can't be used to run dynamic web based applications(Servlets's & Jsp's)
Implementation of servlet-api is called servlet container . servlet container is part of server. It is the
resposibilty of the server container to create servlet object and call the methods of the servlet
Note:- We can call servlet container as servlet engine
Actually Servlet don't have these implicit Objects After introducing of JSP it contains by default and with readymade Objects to use in our web applications.
These are available for programmer through Container. The implicit objects are parsed by the container and inserted into the generated servlet code. They are available only within the jspService method and not in any declaration. Implicit objects are used for different purposes. Our own methods (user defined methods) can't access them as they are local to the service method and are created at the conversion time of a jsp into a servlet.
These are 9 implicit Objects
request
response
page
pageContext
application
exception
out
config
session
Introduction about JSP's:-
1) Jsp is used to develop web based applications
2) Jsp's are used as alternative to servlets
3) Generally we place Jsp's programs inside the project folder outside the WEB-INF folder extension of JSp program must be .Jsp
4)we are created the following JSP
5) To set the above JSp we use the following URL
htttp://localhost:9000/projectname/one.jsp
Every server uses a cache folder to do a temporary work incase of tomcat it uses work as a cache folder
Advantages of Jsp:-
1) Jsp improve productivity of the developer (delivey the project quickly to the customers)
2) We can develop Jsp's without the knowledge of Java
3) Jsp's are used to seperate out business logic and presentation logic
4) Every server will have a cache memory. In case of tomcat work folder is acting as cache
5) Jsp is an automatically develop servlet. This servelt is generated by the server
6) Apache corporation as released so many projects we use apache HTTP server to run static web based applications HTTP server can't be used to run dynamic web based applications(Servlets's & Jsp's)
What is servlet container?
Implementation of servlet-api is called servlet container . servlet container is part of server. It is the
resposibilty of the server container to create servlet object and call the methods of the servlet
Note:- We can call servlet container as servlet engine
Q: | Difference between forward and sendRedirect? |
A: | When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completly with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completly new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward. |
Q: | What are the different scope valiues for the <jsp:useBean>? |
A: | The different scope values for <jsp:useBean> are 1. page 2. request 3.session 4.application |
Q: | Explain the life-cycle mehtods in JSP? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A: | THe generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Hte HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces. The JspPage interface declares only two mehtods - jspInit() andjspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol. However the JSP specification has provided the HttpJspPage interfaec specifically for the JSp pages serving HTTP requests. This interface declares one method_jspService(). The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance. The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects. The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called n the servlet instance.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No comments:
Post a Comment