Developing a Whitebeam Application

Site Map
 
Home
 
Application Guide
  Quick Start
    Introduction
    Application
    Administration
    Source
    Structure
    Forms Data
    Sessions
    Access Ctrl
    Templates
    Files
    Debug
    File Loc
    Hints+Tips
  PHP and ASP
  Writing Apps
  Applications
  Tutorials
  Samples
Reference
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Developing a Whitebeam Application

Source Code

A Whitebeam application generally consists of a set of "source" files that together provide the desired look, feel and functionality required to support a client. These files are contained in a hierarchical file structure decided on by the Integration Partner. The site comprises any combination of static web pages, Whitebeam Pattern Pages and various 'other' files (e.g. bitmaps and gifs).

An application may also have data pre-loaded onto the Whitebeam database along with dynamic data that is captured in operational mode. Such data may include any type of file (from the file system or generated) which is treated as binary data (up to a size of 100K initially) by the Whitebeam system.

Writing a Whitebeam application requires technical skills in:

SkillDescription

HTML

Hypertext Mark Up Language for formatting web presentation pages.

JavaScript

An interpreted programming language with object-orientated capabilities that is used extensively to create dynamic HTML content. JavaScript is run on browsers and also, on the Whitebeam system, on the server (see below).

Whitebeam JavaScript

A JavaScript-derivative language is defined to provides access to the Whitebeam Object Model (ROM), and in turn, to the exported interfaces of Whitebeam Templates

Whitebeam XML Mark-up

A collection of Whitebeam defined XML Mark-up that augments the standard HTML with special tags and attributes that are interpreted by the Presentation Engine. The mark-up tells the Whitebeam System what data to send to the client.

Pattern Page

A pattern page is a Whitebeam source file that has a very similar format to a static HTML source file but with the addition of some Whitebeam-specific XML tags and (optionally) Whitebeam JavaScript. It can also be written using any basic text editor.

A simple example of a pattern page would be:

<html>
  <head>
    <title>Example Page</title>
  </head>
  <body>
    <rb:script>
      rb.page.write('<p>Hello'+' '+'world</p>');
    </rb:script>
  </body>
</html>

When a request is made to serve this pattern page, the Whitebeam Presentation Engine will, in this case, automatically parse, generate, and deliver to the browser the HTML presentation page:

<html>
  <head>
  </head>
  <body>
    <p>Hello World</p>
  </body>
</html>

XML and Server Side JavaScript

A web site design generally consists of many different types of file. Most of these are simply requested by the client, located by the server and returned to back to the client. This items are 'static' meaning they never change, except at the hand of the designer. Once the files have been placed on the web server they are delivered unchanged to the client browser. Examples of static resources include everything you'd expect to see on a static site - images, documents, HTML source etc.

A Whitebeam Pattern Page is an active element. Instead of being forwarded transparently to the client the page is given to the Presentation Engine. It is the responsibility of the Presentation Engine to open the Pattern Page and execute the 'code' within that page to generate the data to be sent to the browser.

A Pattern Page has the following characteristics:

 Description
.rhtm filename extensionAll Pattern pages must have a filename extension of '.rhtm'. This is the means by which the Whitebeam System knows the file contains a Pattern Page and must be routed via the presentation engine.
XML structureAll files are expected to contain conformant XML mark-up. The contents will be processed first by the Presentation Engine and then by the browser. The XML in the file is a combination of the following:
Client Side XHTMLBasic web page content to the sent to the client. Note that the Whitebeam System requires valid XHTML mark-up, although it will do its best to process non-conformant code (such as older HTML) the best results are to be achieved by following the XHTML guidelines.
Server Side XMLSpecial XML Mark-up that is understood by the Presentation Engine. This mark-up is replaced by the presentation engine before the generated page is sent to the client. This mark up - a combination of XML tags and XML attributes - effectively form a sequence of instruction for the Presentation Engine on how to generate the dynamic content of the Web Page. Whitebeam have implemented a number of pre-defined tags (all have the form rb:something) but the developer can, in fact, define his own XML tags and what the Presentation Engine does when it encounters them.

When a request is received for a dynamic '.rhtm' file the Presentation Engine executes the Pattern page and replaces the server side code as appropriate.

The Presentation Engine is basically an XML processor closely coupled with a JavaScript interpreter. The XML processor is fairly "lenient" towards HTML but in general Whitebeam recommends that all pages conform to the XHTML recommendations.

An example of Whitebeam XML mark-up is <rb:script> tag (and its corresponding closing tag </rb:script>). This marks a block of server side JavaScript. Another example is the <rb:include src="someFile" /> tag that allows a pattern page to include content from another file (the included file can, in fact, be any legal XML document so there are many possible ways to use this feature). All the Whitebeam tags are fully documented elsewhere.

There are several XML rules to remember when constructing a pattern page:

  • XML is structured so the contents between starting and ending XML tags can only be valid if it follows the defined XML DTD. For instance the <rb:script> tag can only contain server JavaScript, no other XML or HTML.

  • XML tags can be closed by including a "/" before the closing angle bracket but although legal it renders some Whitebeam tags ineffective e.g. <rb:script/> is legal but will not do anything!

  • XML tags can be placed within HTML provided the starting and closing tags are within HTML block tags e.g. <p><rb:script>..program..</rb:script>..something..</p> is legal but <p><rb:script>..something..</p></rb:script> is not.

  • XML attributes (such as rb:eval) can be placed within any XML/HTML tag and get "executed" by the Presentation Engine. The result is a substitution of the original XML with the output of the evaluation.

  • The syntax of statements must follow XML rules. In most cases this is straightforward and intuitive but one exception is the way to encode special characters within tags. You cannot escape by preceding the character with a \ but have to use the XML syntax of %nn for a character or the &quot; etc. mnemonics. For instance to place a quoted string within two other levels in an <rb:eval> tag would look like this: <rb:eval expr="if (isUser) rb.page.write('<input type=&quot;submit&quot; name=&quot;update&quot; >');" />

  • No Whitebeam tags can be placed within JavaScript either on the server or client side. On the server side there are Resource Object Model (ROM) equivalents of appropriate tags (e.g. rb.page.redirect() rather than rb:redirect src="dfghsd"/>). On the client side to generate client JavaScript you have to write the code out using rb.page.write () calls e.g.

rb.page.write("<script language='JavaScript'>\n<!--\n");
rb.page.write ("var isUserMsg = "+isUserMsg+";\n");
rb.page.write ("var userMsg = "+userMsg+";\n");
rb.page.write("//--></script>\n");

Whitebeam release 1.3.36
(loadtime : 7ms)