| Structuring an ApplicationIf you have a background in structured programming and object oriented design 
  techniques producing an application that uses a browser interface can leave 
  you cold. The issue is the way to structure the application when the device 
  used to control program flow, the hyperlink, is essentially a "goto". 
  Whitebeam recommend a specific structure and have designed some key features 
  into the system to support it. A requested page often has to do more than just present data and a few hyperlinks 
  e.g. it might have to be a form in order to submit parameters back. The URL 
  to which the page is then submitted may have to do some server processing and 
  then present a new page back to the originator. However it might need to present 
  a different page depending on the parameters submitted. This can sometimes be 
  achieved by dividing the submitted page into a number of separate forms, each 
  form with a different submit URL. However this is not always possible and anyway, 
  typically leads to duplicated code. To avoid this problem Whitebeam recommends that in most cases the code that 
  processes a form is in the same page as generated the form. i.e. the form 
  is submitted to itself. This makes it much easier to structure the application, 
  code variable names etc. You are probably asking how, if a form submits to itself, 
  do you put up a new, different form or page? The Whitebeam system supports a 
  redirect mechanism, available either through an XML tag: <rb:redirect src="somewhere" />
 or alternatively through the ROM: rb.page.redirect("somewhere")
 This causes the presentation engine to discard all page output from the currently executing 
  Pattern page and start again with the redirected Pattern page. Note that a redirect 
  is not a goto. It is structured in that execution of the original page will 
  continue after the redirected page is processed. Although no page output will 
  be produced, any side effects of program execution will still take place (e.g. 
  you could have a piece of code on the original page that "tidied up" 
  after any redirect).  Another, associated mechanism supported by the Whitebeam system is the included 
  page (<rb:include src="something" /> 
  tag). The included item does not have to be a complete page, any valid XML 
  document is acceptable. The include mechanism also enables sections of the named 
  file to be selected as specified by an id attribute; those sections in the included 
  file being identified by a rb:id attribute in the tag name. |