Java EE Web Components

Servlets :- Java Servlets are the Java equivalent of CGI scripts that can be used to perform processing and the servicing of client requests on a web server. Servlets are simply Java classes that implement a predefined interface and used to dynamically generate content for presentation to the user by embedding markup language (e.g. HTML) inside the Java code. As Servlets are written in Java, they have access to the rich library of features provided by Java, including access to databases and other enterprise resources such as EJB.
     These are Server side components that define HTTP specific servlet classes but not restricted to HTTP.
  Servlets can respond to any type of request , these are commonly used to extend  the applications hosted by servers and can be used to deliver dynamic content.

      They are better choice than CGI (common gateway interface) as they are portable, scalable and easy to maintain.

Figure 1 Servlets(EE Web Components)

JSP (Java Server Pages) :- It  is other than servlet technology for presenting information to the user over the web and uses Java code, embedded into the HTML - the opposite of servlets but much similar to  Microsoft ASP. Generally all the pages are written as HTML files with embedded Java source code known as scriptlets.  It is very easy to build large pages containing lots of embedded Java code and business logic so it provide easy integration with JavaBeans and another feature called JSP tag extensions. These custom tags (also known as custom actions) allow re-usable functionality to be encapsulated into XML-like tags that can be easily used on the pages by both page developers and designers. There are some special features of JSP.

      Similar to Servlets but unlike servlets , JSPs are text based documents that are combination of HTML and JSP tags, java code & other information.
      JSP clearly separates presentation logic and business logic.
      JSP pages are lightweight and fast and provide a lot of scalability to web applications.

Figure 2 JSP(EE Web Components)



No comments:

Post a Comment