In this section of blog, we will look into server side technologies that are popular. We will compare Other leading technologies with one of the highly used technologies called as Java Server Pages (JSP). So, What exactly do we mean by JSP ?. A JSP is a web-based powerful technology in which an html page has Java code embedded to it. It is one of the powerful technology which is implemented on server side to provide dynamic as well as static content to a client browser. It provides Java Developer and Web designer a way to execute a Java codepresent in a html page on the server side. Generally, the Java code embedded into an html page returns static or dynamic content upon executing on server side. The static content can be anything from normal html page, xml or simple txt etc. The dynamic content is been generated by Java code embedded into the web-page.
JSP Versus SERVLETS
It is been seen that JSP and Servlets provides dynamic content to a web-page, but in a different way. Both technologies are powerful and complimentary to each other. Servlets and JSP operate quite differently and even opposite at some extent. A Servlet is a simple Java program in which html is embedded. The Java program executes on the server-side and display the result to the browser by embedding html which is output to the browser. The Servlet embed html into Java code through out.println statements.
Relation between JSP and Servlets
Usually JSP and Servlets are very closely related to each other. Each JSP is first compiled into a Servlet before it can be used. When a first call is made to JSP, it translates to Java Servlet source code and then with the help of compiler it gets compiled to Java Servlet class file. This class file gets executed in the server and result are returned back to client.
Advantages of JSP over Servlets
Servlets use println statements for printing an HTML document which is usually very difficult
JSP needs no compilation, CLASSPATH setting and packaging.
In a JSP page visual content and logic are seperated, which is not possible in a servlet.
There is automatic deployment of a JSP, recompilation is done automatically when changes are made to JSP pages.
Usually with JSP, Java Beans and custom tags web application is simplified.
Advantages of JSP over other Technologies
Active Server Pages (ASP) : ASP is a Microsoft technology. The dynamic part of JSP is written in Java, so it is more powerful and easier to use. Secondly, JSP is platform independent whereas ASP is not.
Pure Servlets : It is more convenient to write regular HTML than to have println statements that generate HTML. Allows separation of look from the content. In a JSP web designer can design web page separately and servlet programmers can insert the dynamic content separately.
Server-Side Includes (SSI) : SSI is widely supported technology for including externally defined pieces into a static web page. JSP is better because it lets you use servlets instead of a separate program to generate that dynamic part. Besides, SSI is really only intended for simple inclusions, not for real programs that use form data, make database connection.
Static HTML : Regular HTML cannot contain dynamic information. JSP is easy and convenient. It is quite feasible to insert small amounts of dynamic data.
For more of such hot topics read my other posts here :
Visit my new website