Thursday 6 September 2018

Overview of JSP


Overview

JavaServer Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. JSP have access to the entire family of Java APIs, including the JDBC API to access enterprise databases. JavaServer Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content. 
JavaServer Pages (JSP) is a technology for developing web pages that support dynamic content which helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with <% and end with %>. 
A JavaServer Pages component is a type of Java servlet that is designed to fulfill the role of a user interface for a Java web application. Web developers write JSPs as text files that combine HTML or XHTML code, XML elements, and embedded JSP actions and commands. 
Using JSP, you can collect input from users through web page forms, present records from a database or another source, and create web pages dynamically. 
JSP tags can be used for a variety of purposes, such as retrieving information from a database or registering user preferences, accessing JavaBeans components, passing control between pages and sharing information between requests, pages etc.

Advantages of JSP

JSP offer several advantages in comparison with the CGI.
  • Performance is significantly better because JSP allows us to include Dynamic Elements in HTML Pages.
  • JSP are always compiled before they get processed by the server.
  • JSP are built on top of the Java Servlets API, hence like Servlets, JSP also has access to all Java and J2EE 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.
  • It is easier to write and maintain the HTML. Your normal HTML (static code) is has many limitations like no extra backslashes, no double quotes, and no lurking Java syntax.
  • You can use standard Web-site development tools. We can make use of many tools like Eclipse, Macromedia Dreamweaver for developing JSP. Even HTML tools that know nothing about JSP can be used because they ignore the JSP tags.
  • You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.

Advantages of JSP over other technologies


  • Active Server Pages (ASP): The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.

  • Servlets: It is more convenient to work with regular HTML than to have plenty of Java Code with println statements that generate the HTML.

  • Server-Side Includes (SSI): SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like.

  • JavaScript: JavaScript can generate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc.

  • Static HTML: Regular HTML, of course, cannot contain dynamic information.


Following diagram shows the position of JSP container and JSP files in a typical Web Application. 


Enjoy Learning.

No comments:

Post a Comment