JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»

NOTE We are not saying that the server API is useless. In fact, many interesting problems (e.g., content filtering and redirection in the native web server) can only be solved within the context of the server API. Moreover, most of the extension techniques that we are about to see use the server API to link to the web server. This API is, however, more suited for low-level tasks and too cumbersome and costly to use in developing full-scale web applications.

1.3.3 Server pages techniques

The goal of the server pages approach to web development is to support dynamic content without the performance problems of CGI, or the difficulty of using a server API. The most popular server page approaches today are Microsoft Active Server Pages (ASP), JSP from Sun Microsystems Inc., and an open-source approach called PHP. Server pages development simplifies dynamic web development by allowing programmers to embed bits of program logic directly into their HTML pages. This embedded program logic is written in a simple scripting language (which, depending on what your server supports, could be VBScript, JavaScript, Java, or something else). At runtime, the server interprets this script and returns the results of the script’s execution to the client. Let’s look at an example of ASP in listing 1.1.

The big picture

Listing 1.1

Sample ASP fragment that generates dynamic content

<% @Language = <HTML>


= «VBScript» %>

<% If Request You asked <% else %>

You asked <% end if %>

.ServerVariables(«SERVER NAME») = «localhost» then %> for the server located on your local machine.

Скачать в pdf «JSP Tag Libraries»