- This lesson will teach you the following concepts
- Principle of Browser/Server
- How does it work?
- And in WEBDEV?
- Practical example
- And in WEBDEV? (Session/AWP, PHP, Static)
- Practical example
- The method for creating a site
Lesson 1.2. The Web development and WEBDEV
This lesson will teach you the following concepts
- Principle of Browser/Server.
Estimated time: 30 mn
Principle of Browser/Server
How does it work?
An Internet or intranet site operates as follows:
- The client (the Web user) is using a browser to access the site.
- The browser sends a request to the server that is hosting the requested site. In this request, it indicates the page that must be displayed and different parameters allowing the server to build the corresponding page.
- The server receives this request, processes it and returns the corresponding "HTML" page. HTML (HyperText Markup Language) is the language used by all browsers to display the Web pages.
Therefore, there are two types of events:
- Events run at browser level, on the Web user's computer.
- Events run at server level.
And in WEBDEV?
With WEBDEV, everything is developed:
- in WYSIWYG ("What You See Is What You Get") in the editor: your pages are visually identical in creation and at run time.
- in WLanguage for the programming side.
WEBDEV converts your page created in the editor into HTML page that can be read by the browsers.
The server code is run in WLanguage.
To create a site with WEBDEV, a single language is required: WLanguage.
However, two types of code are available: server code and browser code.
Why this distinction between server/browser? For performance reasons. Indeed, between the browser and the server stands Internet, with its response time, latency, ... Some simple operations can be performed on the browser directly, without having to go back to the server.
- To better understand the difference between server and browser events, we have prepared a simple example:
- Start WEBDEV 24 (if not already done). Display the WEBDEV home page if necessary: press Ctrl + <.
- Open the "WEBDEV concepts" project. To do so, in the home page, click "Tutorial" and select the project named "WEBDEV concepts (Exercise)".
|If the UAC is enabled in Windows, a specific window may be displayed. This window indicates that the WD240Admin.exe program will be run on the current computer. Grant the authorization. This program corresponds to the local WEBDEV administrator that is used to run the test of sites developed with WEBDEV. Its features will be presented later in this tutorial.|
- Open the "PAGE_Registration" page in the editor: double-click its name in the project explorer.
|The project explorer is used to display in the environment the list of all elements found in the project. These elements are grouped by theme: Pages, Procedures, ...|
To display the project explorer:
- On the "Home" pane, in the "Environment" group, expand "Panes".
- In the list of panes that is displayed, select "Project explorer".
- This page contains edit controls and a "Register" button. The "Register" button must perform two things:
- Check that all controls have been filled.
- Save the values of controls in the database.
- Let's see the code associated with the button:
- Select the "Register" button.
- Display the popup menu of button (right mouse click) and select "Code".
- The code editor is displayed with the different events linked to the Button control. To see all the events associated with the button, press the Page Up key.
|The code editor allows you to write the code of your processes.|
The code editor presents the events associated with each control, which means the events on which a specific process can be run.
Note: Events are displayed in the order in which they will be run.
For example, the events associated with the Button control are:
- Browser click.
- Server click.
- Let's study the code displayed: the server code and the browser code are identified by different colors:
- The browser code, that will be run on the computer of Web user, is displayed in green.
- The server code, that will be run on the server, is displayed in yellow.
In our example, all input checks are performed in browser code (green code). For example, the EDT_LastName control must not be empty. The corresponding code is as follows:
// Check whether the "EDT_LastName" control is equal to empty string
// (excluding spaces and punctuation)
IF EDT_LastName ~= "" THEN
// The control is empty, display an error message to
// the user
Error("Type your last name")
// Return in edit into the "EDT_LastName" control (without running
// the rest of code)
This check is performed in browser code because there is no need to go back to the server to check that the controls are filled.
This is used to avoid useless round trips and to reduce the wait for the Web user: the navigation is more fluid.
Once the browser code was run, the page sends the values typed to the server. Then, the server runs the server code. In the server code, you have the ability to process the information received.
In our example, the information received is added into the database via the following code:
// Reset the customer structure
// Get the values of controls in
// the customer structure
// Add the customer into the database
This operation cannot be performed in browser code because the database is common to all site users and therefore it is located on the server.
- Close the code window (click the cross in the top right corner).
- Close the page displayed in the editor (click the cross in the top right corner).
An Intranet or Extranet site
is often considered as being a management application in Web mode, which means an application run in a browser.
This Web application can present:
- business features intended for specific users,
- processes that must be secured: not everyone should be able to access the application.
The Web application can be accessed:
- from a company network only, in which case we talk of Intranet site.
- from Internet, in which case we talk of Extranet site.
In both cases, the Web application is secured by managing logins, passwords, rights, etc.
An Internet site is a site meant for "public" consumption (business users or regular users).
An Internet site must be easily found on the Web. Some examples: presentation site, e-commerce site, ...
To bring more Web users to your site, the site must be referenced by the search engines. In order for the search engines to reference each page properly, an additional constraint appears: the site pages must be accessible at any time. But this constraint is also a guarantee of simplicity for the Web user: he can easily copy/paste a link from a page and re-use this link whenever required.
And in WEBDEV? (Session/AWP, PHP, Static)
In WEBDEV, to develop an Intranet or Extranet site
, the "Session" mode is more suitable because it includes the following features: integrated security, automatic contexts.
Indeed, the Session mode includes automatic sessions. The session identifier is included in the URL. The address for the pages depends on this identifier which changes for each connection.
Drawback: The search engines cannot index this site.
In WEBDEV, to develop an Internet site, you can choose one of the following modes:
- The AWP mode (Active WEBDEV Page).
- The PHP generation mode.
- The static mode if your site contains preset pages only (no database).
- Now, let's check the behavior of an Intranet page:
- Open the "Page_Home_of_Intranet_site" page in the editor: double-click its name in the project explorer.
- Let's check the page type:
- On the "Page" pane, in the "Description" group, click "Description" (you can also select "Description" from the popup menu of the page).
- In the "General" tab, the page is a page in session mode, a mode used for Intranet/Extranet sites.
- Run the test of this page: click the icon among the quick access buttons.
- The page is displayed in the browser.
- Study the address displayed in the browser. The URL has the following format: http://localhost/WEBDEV_Concepts/CONNECT_TESTMODE/<Connection Identifier> where <Connection Identifier> is a string that changes at each connection. The address changes at each connection therefore the security is improved. However, this behavior is not compatible with a referenceable site.
- Close the browser.
The method for creating a site
Now that the main Web concepts have been presented, let's see how to develop a WEBDEV site.
To create a site with WEBDEV, use the following method:
- Creating the site model:
- Model of pages (user experience).
- Definition of CSS styles (if necessary).
- Designing the database structure.
- Development in WEBDEV:
- Creating a project that groups all the site elements.
- Creating the page templates that will define the site style. These templates are based on the model of pages, the CSS styles and the WEBDEV styles.
- Defining the database (Analysis), that can re-use an existing structure.
Click [Add] to post a comment