JSP (Java Server Page) Technology
JavaServer Pages (JSP) technology allows us to easily create web application that has both static
and dynamic components.
JSP page combine static markup, like HTML, and XML with special scripting tags. JSP pages can be design and developed less like programs and more like web pages.
What Is a JSP Page?
A JSP page is a text document that contains two types of text: static data, which can be expressed
in any text-based format (such as HTML, SVG,WML, and XML), and JSP elements, which
construct dynamic content.
The recommended file extension for the source file of a JSP page is .jsp.
The main features of JSP technology are as follows:
- A language for developing JSP pages, which are text-based documents that describe how to
process a request and construct a response.
- JSP provides certain implicit objecs, based on the Servlet API. These object are accessed using standard variables, and are automatically available for uwe in our JSP without writing extra code.
- An expression language for accessing server-side objects.
- Mechanisms for defining extensions to the JSP language.
JSP Advantage over Servlet :
What is difference between JSP and Servlet?
- The main difference between Servlets and JSP is that Servlets support all protocols like HTTP,FTP,SMTP etc. while JSP supports only HTTP protocol.
- That’s why JSP is used only mainly for presentation
- Servlets are fast because they are pure java classes whereas JSP is slow because first they converted in java code that in class file.
- Servlet is a pure java class whereas JSP is not.
- When we use HTML in java code than it is called Servlet and when we use Java code is html then it is called JSP.
- Servlet is static where as JSP is Dynamic
- Servlets for security. Servlet is like mediator between client and database. Both are important for internet applications.
- Servlet are server side extension functionality. We can implement code at server side by using Servlets. Servlets are used to connect database and maintain security. For writing Servlets we should know code and all classes in Servlet family
- JSP is also used to achieve server side functionality but it is mainly for user friendliness. Here we have html tags to write code easy to remember tags.
- JSP engine will create objects for classes and compiles code automatically.
- JSP tags are used for getting different views for client. JSP is for view to user.
JSP Directory Structure