Why JSP should be used?


JSP Page consists of HTML code and provides an option to include java code for dynamic content. Since web applications contain a lot of user screens, JSPs are used a lot in web applications. Best part about JSP is, it provides additional features such as JSP Tags, Expression Language, Custom tags. This makes it easy to understand and helps a developer to quickly develop JSPs.

Performance of JSP is significantly better because it allows the embedding of Dynamic Elements in HTML Pages itself instead of having a separate CGI(Common Gateway Interface) files.

JSP is always compiled before it is processed by the server unlike CGI/Perl which requires the server to load an interpreter and the target script each time the page is requested.

JSPs are usually used to deliver HTML and XML documents, but through the use of OutputStream, they can deliver other types of data as well.

Java Server Pages are built on top of the Java Servlets API, so like Servlets, JSP also has access to all the powerful Enterprise Java APIs, including JDBC, JNDI, EJB, JAXP etc.

JSP pages can be used in combination with servlets that handle the business logic, the model supported by Java servlet template engines.

Also, JSP is an integral part of Java EE, a complete platform for enterprise class applications. This means that JSP can play a part in the simplest applications to the most complex.

Finally, Java Server Pages can be used for a variety of purposes, such as retrieving information from a database or registering user preferences, accessing Java Beans components, passing control between the pages and sharing information between requests, pages etc.