What is JSP ?
Define JSP :
It is the full form of Java Server Page (JSP). It is a server side programming technology and used for creating web application ,that enables the creation of dynamic, platform-independent method for building Web-based applications. It is based on HTML, XML, SOAP, or other document types.
There are JSP tags to insert Java code. The programmer can write the tag at the end of the Java code. There are different JSP tags which can be used to accomplish various tasks. There are tags to share data between requests and pages and tags to pass control between pages and to get data from databases, etc. JSP is made on top of a Java-based technology called Java Servlet. It is an advanced version of Servlet Technology.
Features of JSP
- JSP coding is easy :- As it is just adding JAVA code to HTML/XML.
- Decrease in the length of Code :- In JSP we use action tags, custom tags etc.
- Easier to connected of Database :-It is easier to connect website to database and allows to read or write data easily to the database.
- Make Interactive websites :- In this we can create dynamic web pages which helps user to interact in real time environment.
- Portable, Powerful, flexible and easy to maintain :- as these are browser and server independent.
- No Redeployment and No Re-Compilation :- It is dynamic, secure and platform independent so no need to re-compilation.
- Extension to Servlet :- as it has all features of servlets, implicit objects and custom tags.
Advantages of JSP
Advantages of JSP over Servlets :
- servlets use println statements for printing an HTML document which is usually very difficult to use. JSP has no such tedious task to maintain.
- JSP needs no compilation , CLASSPATH setting and packaging.
- In a JSP page visual content and logic are separated , which is not possible in a servlet.
- Usually with JSP ,Java Beans and custom tags web application is simplified.
- JSP has the custom tags feature, Which allow us to create reusable components, making it more flexible , compared to servlets
- There is automatic deployment of a JSP ; recompilation is done automatically when changes are made to JSP pages.
Disadvantages of JSP
- Though the database can be accessed with JSP, it is not easy to access the database as most of the servlet does not provide support.
- Java Knowledge is necessary to use JSP effectively.
- Being a servlet, if there’s an issue in the code, it becomes very hard to trace.
- It compilation time required is more than on a server.
- Debugging JSP program are not easy.