From: Subject: JumpStart to the Web technologies tutorial: Server-Side technologies (Application Servers) Date: Thu, 14 Nov 2002 10:48:24 +0100 MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_0020_01C28BCB.5B0C9B50"; type="text/html" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 This is a multi-part message in MIME format. ------=_NextPart_000_0020_01C28BCB.5B0C9B50 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/part_11.html JumpStart to the Web technologies tutorial: = Server-Side technologies (Application Servers)
Jumpstart into=20 the Web technologies: <- Prev. Start Contents References Home Next=20 ->
Server-Side technologies (Application Servers)

  1. Overview=20
  2. Nets= cape=20 LiveWire=20
  3. ASP=20
  4. Al= laire=20 ColdFusion=20
  5. Java=20 Server Pages (JSP)=20
  6. Others= =20

There is no clear definition of what is an 'Application Server' (or = at least=20 I didn't find one). The idea behind these servers is to solve the CGI = problems=20 with performance, session states, database connection pooling etc. = Application=20 Server is a middleware, it used as a middle tier in a classic tree-tiers = application model, browser is a GUI client and a database, to which = application=20 server is connected is a back-end.=20

Here is the list of the main features which usually can be found in = the=20 application servers:=20

Some reviews of different application servers can be found at = ServerWatch - = Application=20 Servers.=20

Below is a little bit more detailed description of some application = servers.=20 Of course it's far from being a full list, there is probably at least 40 = commercially available application servers.=20


Netscape LiveWire

LiveWire is the database connectivity library for the old netscape = server,=20 wich was the first application server, so many others used the similar = model.=20 The way it's working is the following: You write a regular html pages, = but=20 inside them incorporate between the <SERVER> tags the = JavaScript=20 code, which will be executed on server before page is send to the = client. Using=20 the JavaScript application compiler, these files are compiled together = to create=20 the .web file, which contains the application.=20

You can set and retrieve the session variables, which will be = preserved=20 accross the session. There are functions, which allows to do the = database=20 connection pooling and access.=20

Note, that there were no new versions of this, today's netscape = application=20 server is using totally different (mostly Java) technologies. But I = think it was=20 worth to mention because it was the first one.=20

Example:
Assume we want to ask user his name and produce = the next=20 Web page saying 'Hello Joe!'. Let say the page ask.html = prompts=20 user for his name. Here is how the code in Server-Side JavaScript will = look=20 like:

...
<SERVER>
if (!request.name)
  redirect('ask.html');
</SERVER>
...
<H2> Hello <SERVER>write(request.name);</SERVER> =
</H2>

More on this technology can be found at Netscape Server-Side JavaScript documentation.=20

Go back to top=

ASP

Microsoft ASP using the similar technology, but instead of JavaScript = it's=20 using as a default language Visual Basic scripting edition (VBScript), = but you=20 can also choose JScript (MS version of JavaScript), although most of the = places=20 use VBScript. All ASP code is enclosed between a <% and a %> tags. = All ASP=20 pages should have extension .asp. ASP runs on MS IIS and PWS = (Personal=20 Web Server) and there are ports of ASP to other platforms by third party = vendors.=20

Example:
Same example as in the previous chapter, but = written with=20 ASP:

....
<%
IF NOT Request.Form("Name") THEN
  Response.Redirect("ask.html")
ENDIF
%>
<H2>Hi <%=3DRequest.Form("Name")%> !</H2>
....
The funny thing is that I didn't find any good ASP tutorial on the = Web, in=20 the best case it was a 2-3 pages overview... Try to check for more info = ASP=20 overview from Microsoft Web site. If you get 'Microsoft JScript = compilation=20 error' don't give up, I've got it 2 out of 3 times on each page, just = reload it=20 and may be you'll get lucky (I guess it's a nice example of this = technology)=20 :-)).=20

Go back to top=

Allaire ColdFusion

Allaire ColdFusion uses the different approach. Instead of embedding = some=20 programming language into the HTML pages it uses its own proprietary = ColdFusion=20 Markup Language, or CFML, which is a tag-based language. It has about = 100=20 build-in tags to access the variables, databases, build conditions etc. = In=20 addition it allows you to create the custom tags, which can be created = with CFML=20 or using C++ and CF API. Allaire Web site has a big collection of custom = tags=20 submitted by developers.=20

The plus of this approach is that it's very easy to learn even if you = are not=20 a programmer. The minus is, that if you need to create a complex = application,=20 you need to use C++ which will be linked to ColdFusion server. This = creates the=20 problem, that if you have pretty big amount of code, you have a good = chance of=20 having some memory leaks in it, but since this code is running all the = time=20 inside the CF server it can easily lead to disaster (like server using = too much=20 memory and eventually crashing).
ColdFusion comes with ColdFusion Studio, which is a very nice = development=20 environment similar to their HomeSite product.=20

All ColdFusion files ends with .cfm. Web server (it can be = apache,=20 netscape or IIS) hands over to ColdFusion server any file which ends = with=20 .cfm. ColdFusion server processes the file (all CF tags) and = sends the=20 output (HTML) back to the Web server, which sends it to the browser.=20

Example:
Same example with ColdFusion will look like: =

....
<CFIF IsDefined("Form.Name")>
  Hi, #Form.Name# !
<CFELSE>
  <CFLOCATION URL=3D"ask.html">
</CFIF>
....

More info on ColdFusion can be found on Allaire Web site.=20

Go back to top=

Java Server Pages = (JSP)

The idea behind the JSP is basically the same as it was with the = server-side=20 JavaScript, with the only difference, that it's Java instead of = JavaScript.=20

Java code is enclosed inside the <% ... %> = brackets or=20 tags like: <jsp ... />=20

JSP uses the similar technology as ASP, but it's based on Java = instead of=20 Visual Basic or other MS-specific language, so it is more powerful and = portable=20 to any other system with non-Microsoft Web servers.=20

The way JSP is working: there is a JSP server running, which knows = how to=20 handle the .jsp files. Web server (it can be any Web server, apache, = netscape=20 etc.) hands over to JSP server any file which ends with .jsp. JSP server = processes the file and sends the output (HTML) back to the Web server, = which=20 sends it back to the browser.=20

Example
Same example with JSP will look like:

...
<%
if (request.getParameter("name") =3D=3D null) {
%>
  <jsp:forward page=3D"ask.html"/>
<% } else { %>
<H2>
  Hello <% out.println(request.getParameter("name")); %> !
</H2>
<% } %>
...
More info on JSP can be found at Sun's JSP documentation=20

Go back to top=

Others

  • Bluestone=20 Sapphire/Web - Both application server and development = environment, which=20 produces server, which can be Java or C based. Very good failover and=20 loadbalancing capabilities. High price tag ($25K+).=20

  • Java = Servlets -=20 Basically the CGI programs written in Java. The good thing about it, = that it=20 runs in Java thread instead of a process, so it saves the start time.=20

  • PHP - PHP is a server-side = scripting=20 language, which looks similar to Perl and C-Shell. It's embedded in = the=20 similar way as others inside the HTML. It's open source and free and = can run=20 on many platforms. Work similar to things like ASP and ColdFusion in = the way,=20 that it has a server, which processes all .php pages. With = apache's=20 mod_php, it will work as a thread within apache.=20

  • Server Side Includes (SSI) - the technique which allows to embed = the=20 simple server directives in the HTML pages. Using this technology you = can=20 include the other files into HTML (<!--#include=20 file=3D"filename"-->), provide last modification time for a = file=20 (<!--#echo var=3D"LAST_MODIFIED"-->) or even run = some=20 commands on the server.

More references to the application servers info can be found here.=20

Jumpstart into=20 the Web technologies: <- Prev. Start Contents References Home Next=20 ->

Copyright =A9 2000 Sergey=20 Gribov
------=_NextPart_000_0020_01C28BCB.5B0C9B50 Content-Type: text/css; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/style.css .toolbar1 { PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; FONT-WEIGHT: bold; FONT-SIZE: = 8pt; PADDING-BOTTOM: 1pt; COLOR: #002255; PADDING-TOP: 1pt; FONT-FAMILY: = Tahoma, Arial, sans-serif } .toolbar2 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = 8pt; PADDING-BOTTOM: 1pt; COLOR: navy; PADDING-TOP: 1pt; FONT-FAMILY: = Tahoma, Arial, sans-serif } .title1 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = x-large; PADDING-BOTTOM: 7pt; COLOR: navy; PADDING-TOP: 10pt; = TEXT-ALIGN: center } .title2 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = x-large; PADDING-BOTTOM: 7pt; COLOR: navy; PADDING-TOP: 10pt; = TEXT-ALIGN: center; TEXT-DECORATION: underline } P { PADDING-RIGHT: 5pt; PADDING-LEFT: 5pt; PADDING-BOTTOM: 7pt; = PADDING-TOP: 7pt } ------=_NextPart_000_0020_01C28BCB.5B0C9B50 Content-Type: application/octet-stream Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/navig.js =0A= // Navigation function to go to the next / previous page=0A= // n is offset (1, -1 etc.)=0A= function goto_page (n) {=0A= var first =3D 0;=0A= var last =3D 14; // should be the next after the last one=0A= var part_name =3D "part_";=0A= var loc =3D window.location.href;=0A= var re =3D /(.*)\/(\w+)\.html([^\/]*)$/;=0A= var ra =3D re.exec(loc);=0A= =0A= // may be it ends with '/' instead of index.html=0A= if (ra =3D=3D null) {=0A= ra =3D re.exec(loc + "index.html");=0A= }=0A= var path =3D ra[1];=0A= var fname =3D ra[2]; =0A= =0A= // alert("=3D=3D" + ra[1] + "=3D=3D" + ra[2] + "=3D=3D" + ra[3]);=0A= =0A= if (n !=3D -1 && n !=3D 1) {=0A= alert("Hmmm... Wrong parameter to goto_page()...");=0A= }=0A= else if (fname =3D=3D "index" || fname =3D=3D "content") {=0A= if (n =3D=3D -1) {=0A= window.location.href =3D path + "/index.html";=0A= }=0A= else { // +1=0A= window.location.href =3D path + "/" + part_name + "1.html";=0A= }=0A= }=0A= else if (fname =3D=3D "reference") {=0A= if (n =3D=3D -1) {=0A= window.location.href =3D path + "/" + part_name + last + ".html";=0A= }=0A= else { // +1=0A= window.location.href =3D path + "/reference.html";=0A= }=0A= }=0A= else {=0A= var re1 =3D new RegExp("^" + part_name + "(\\d+)");=0A= var ra1 =3D re1.exec(fname);=0A= var num =3D parseInt(ra1[1]);=0A= if (num !=3D null) {=0A= num +=3D n;=0A= if (num > last) {=0A= window.location.href =3D path + "/reference.html";=0A= }=0A= else if (num <=3D first) {=0A= window.location.href =3D path + "/index.html";=0A= }=0A= else {=0A= window.location.href =3D path + "/" + part_name + num + ".html";=0A= }=0A= }=0A= else {=0A= alert("Hmmm... the filename " + fname + " looks strange...");=0A= }=0A= }=0A= }=0A= ------=_NextPart_000_0020_01C28BCB.5B0C9B50--