Difference between revisions of "Recital Web Getting Started"

From Recital Documentation Wiki
Jump to: navigation, search
(Tags)
Line 12: Line 12:
  
 
<code lang="html">
 
<code lang="html">
 +
<html>
 +
<body>
 
<table>
 
<table>
 
<%
 
<%
    set sql to vfp
 
 
     open database southwind
 
     open database southwind
 
     use suppliers
 
     use suppliers
Line 30: Line 31:
 
%>
 
%>
 
</table>
 
</table>
 +
</body>
 +
</html>
 
</code>
 
</code>
  
Line 57: Line 60:
 
   
 
   
 
When you use Recital Enterprise Studio to develop and test your .rsp pages, it will automatically synchronize JavaScript and .wsp files into the wwwscripts directory and images (.gif, .jpg, and .png) into the wwwimages directory.
 
When you use Recital Enterprise Studio to develop and test your .rsp pages, it will automatically synchronize JavaScript and .wsp files into the wwwscripts directory and images (.gif, .jpg, and .png) into the wwwimages directory.
 +
 +
==Quick Start Guide==
 +
# Create or add an existing RSP page to your project. To add existing RSP pages to the project, select Project|Add Files To Project...  from the Menu Bar .
 +
# Test the RSP page by right clicking on it in the "Project Explorer" then choose "Run".
 +
 +
Tip
 +
If you use the attribute <%@ codebehind="scripts/filename.wsp" %> in the RSP file, you can edit the Recital 4GL code with full syntax color highlighting and IntelliHelp.
 +
 +
# Use the showdocument() function in your server based Mirage application to send the request for an RSP page and for the content to be generated dynamically and then rendered in the browser on the desktop PC.
 +
 +
<code lang="recital">
 +
showDocument("http://" + getLocalHost() + ":8001/myrspfile.rsp", "_blank")
 +
</code>

Revision as of 17:05, 9 March 2010

Overview

Recital Web is a data centric HTTP Server that incorporates a Database and 4GL. Using Recital Web you can generate dynamic content web pages with the Recital/4GL. Recital Web can coexist with the existing Web Server on your system, so there is no disruption to your existing web site infrastructure. Using Recital Web, you can generate rich reports that can be integrated in with Recital Mirage .NET applications or Recital Terminal applications.

RSP Basics

The Recital Web HTTP server handles the generation of dynamic content HTML and sends this back to the browser that requested the page. These pages have a ".rsp" extension (Recital Server Page). Recital Firecat can serve static html pages, images, and Recital Server Pages (.rsp pages) similar to the way PHP dynamic pages are generated. With Recital Firecat .rsp pages, you can embed Recital/4GL scripting commands inside HTML documents. Recital Server Pages are really just HTML files with Recital/4GL scripting embedded within them. Any scripting commands that are embedded within the file are executed then removed from the results. All scripting code is hidden from the user viewing your web pages.

Tags

To distinguish the RSP code from the regular HTML inside the .rsp file, RSP code is placed between <% and %> tags. The tag combination notifies the Firecat HTTP Server that the code within the <% and %> should be executed by the server and removed from the results. Any output generated by the Recital/4GL code (e.g. using the ? command) will be written to the HTML output that is sent back to the web browser that requested the page.

The following example generates an HTML table that lists all the records in the Suppliers table.

<html>
<body>
<table>
<%
    open database southwind
    use suppliers
    scan
        ? "<tr>"
        for f=1 to fldcount()
            ? "<td>"
            ? &(field(f))
            ? "</td>"
        next
      ? "</tr>"
    endscan
    use
    close databases
%>
</table>
</body>
</html>

You can also echo the result of inline expressions directly using the <%= and %> tags.

<input type="text" name="customer_name" value="<%= &(field(1)) %>">

Firecat/RSP also recognizes several directives. These are enclosed within <%@ and %>. The following directives are handled.

<%@ include="xxx" %>

This directive allows you to include either other RSP files, JavaScript files or HTML files within your .rsp page. This provides the ability to build library pages that can be reused by many .rsp pages.

<%@ codebehind=".wsp filename" %>

This directive allows you to write a .wsp file (Recital program file with a .wsp extension) which can be used to dynamically generate and output the HTML. The advantage of using this approach is that you can edit the .wsp file in Recital Enterprise Studio with full color syntax highlighting and IntelliHelp. If you use this approach, it is advisable to keep all of the .wsp files in the scripts subdirectory of webroot. e.g.

<%@ codebehind="scripts/myproc.wsp" %>

When you use Recital Enterprise Studio to develop and test your .rsp pages, it will automatically synchronize JavaScript and .wsp files into the wwwscripts directory and images (.gif, .jpg, and .png) into the wwwimages directory.

Quick Start Guide

  1. Create or add an existing RSP page to your project. To add existing RSP pages to the project, select Project|Add Files To Project... from the Menu Bar .
  2. Test the RSP page by right clicking on it in the "Project Explorer" then choose "Run".

Tip If you use the attribute <%@ codebehind="scripts/filename.wsp" %> in the RSP file, you can edit the Recital 4GL code with full syntax color highlighting and IntelliHelp.

  1. Use the showdocument() function in your server based Mirage application to send the request for an RSP page and for the content to be generated dynamically and then rendered in the browser on the desktop PC.
showDocument("http://" + getLocalHost() + ":8001/myrspfile.rsp", "_blank")