JSP - Servlets: Introduction

In the early days of the Web, most business Web pages were simply forms of advertising tools and content providers offering customers useful manuals, brochures and catalogues. In other words, these business-web-pages had static content and were called "Static WebPages".

Later, the dot-com revolution enabled businesses to provide online services for their customers; and instead of just viewing inventory, customers could also purchase it. This new phase of the evolution created many new requirements; Web sites had to be reliable, available, secure, and, if it was at all possible, fast. At this time, the content of the web pages could be generated dynamically, and were called "Dynamic WebPages".

The Static Web Pages contents are placed by the professional web developer himself when developing the website; this is also called "design-time page construction". Any changes needed have to be done by a web developer, this makes Static WebPages expensive in their maintenance, especially when frequent updates or changes are needed, for example in a news website.

On the other hand, dynamic Web pages have dynamically generated content that depends on requests sent from the client's browser; this is called "constructed on the fly". Updates and maintenance can be done by the client himself (doesn't need professional web developers), this makes Dynamic WebPages considered to be the best choice for web sites experiencing frequent changes.

To generate dynamic content, scripting languages are needed. There are two types of scripting languages:

  1. Client-Side Scripting:
    • It refers to the classes or programs embedded in a website and executed at the client-side by the client's browser. These scripts can be embedded in HTML code or placed in a separate file and referred to by the document using it. On request, these files are sent to the user's browser where it gets executed and the appropriate content is displayed.
    • In client-side scripting, the user is able to view the source code (as it is placed on the client's browser)
    • Client-side scripts do not require additional software or an interpreter on the server; however, they require that the user's web browser understands the scripting language in which they are written. It is therefore important for the developer to write scripts in a language that is supported by the web browsers used by a majority of his or her users.
    • Ideas of when to use client side scripts:
      1. Complimentary form pre-processing (should not be relied upon!)
      2. To get data about the user's screen or browser.
      3. Online games.
      4. Customizing the display (without reloading the page)
    • Examples: JavaScript, VBScript

  2. Server-side Scripting:
    • It refers to the technology in which the user's request runs a script, or a program, on the web server, generating customized web content that is sent to the client in a format understandable by the web browsers (usually HTML).
    • Users are not able to display the source code of these scripts (the scripts are placed on the server), they can only display the customized HTML sent to the browser.
    • Server-side scripts require their language's interpreter to be installed on the server, and produce the same output regardless of the client's browser, operating system, or other system details
    • Server-side scripting –unlike client side scripting- has access to databases which makes it more flexible and secure.
    • Ideas for when to use server side scripts:
      1. Password protection.
      2. Browser sniffing/customization.
      3. Form processing.
      4. Building and displaying pages created from a database
    • Examples: ASP, JSP, PHP, Perl

RenewSession