Java Hosting » JSP Hosting » JSP tutorial » Why to use JSP?

Why to use JSP?

JSP Versus Java Servlets

Before the advent of JSP, the most-used Java technology that could generate dynamic Web page content was Java servlets. Because JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

However, coding JSPs is easier than coding Java servlets. With JSPs, you place static text by coding HTML tags as opposed to Java servlets, in which you place static text by coding a plentitude of println statements.

With JSPs, you change static text by changing HTML; and with Java servlets, you change static text by modifying a Java servlet (don t forget the compile/debug cycle!).

JSP Versus Active Server Pages

Active Server Pages (ASP) is the Microsoft solution for providing dynamic Web content. Actually, ASP looks very similar to JSP; both use custom tags to implement business logic and text (HTML) for invariant Web page parts.

However, the devil is in the details, as described in the following: l ASP uses VBScript or JScript, a Microsoft flavor of JavaScript, as its scripting language, whereas JSP uses Java, a more powerful language than VBScript or JScript.

The ASP developer typically uses a Microsoft Web server platform or requires a third party product that permits ASP execution on non-Microsoft platforms.

The JSP developer has a wide variety of Web server platforms available for use. Note These third parties must port Microsoft software components, such as ActiveX, to different platforms in order for ASP to be used on these platforms. l An ASP is interpreted every time the page is invoked, whereas a JSP is interpreted only the first time the page is invoked (or when the page is changed).

However, Microsoft has overcome the previously mentioned limitations of ASP with its release of ASP.NET. ASP.NET, formerly ASP+, promises to be a serious contender against JSP. As of this writing, you may download the ASP.NET Beta-2 release from http://www.asp.net/.

JSPs Versus Client-Side Scripting

Client-side scripting with JavaScript or VBScript is certainly handy and useful, but it does present several problems, including the following:

  • You must count on the customer's browser to have scripting enabled, which, of course, you can
  • Different customers may use different browsers. And coding client-side scripts that work on different browsers can be a headache.
  • Scripting languages used on the client side cannot match the strength and versatility of Java.
  • Client-side scripting languages have very limited access to server-side resources, such as databases. JavaServer pages have access to all server-side resources within the well-defined architecture of J2EE.
  • You have the usual problems of maintaining software on the client that caused your organization to thin the client in the first place.

In short, the advantages of using JSP over competing technologies are as follows:

  • JSP enables a clean separation of business logic from presentation.
  • JSP, by using Java as the scripting language, is not limited to a specific vendor platform.
  • JSP, as an integral part of the J2EE architecture, has full access to server-side resources.

To fully enjoy JSP hosting experience, view our Java hosting offer

Because JSP pages execute on the server, you need not require the client to use a particular browser or have a fixed configuration.

Contact sales!