Managing server redirection

4GL Web page navigation

4GL Web pages provide added support for navigation between pages. Server redirection is the navigation style of choice when a parameter value passed to another page relies on user input, or when you want to validate user input. The 4GL Web page generates the server script that specifies the target page and the values that get passed to parameters on the target page.

A server redirection can initiate a link to another page from anywhere in a server script. Typically you add a Redirect call in a ServerAction event for a command or picture button, or in the AfterAction event for the psPage object or a Web DataWindow control that you place on the page.

All server data is available for parameter binding, because the redirection occurs in the server script. The page gets processed by the server, enabling the page to take advantage of all variables available there. Because the ASP object model does not support 4GL functionality, server redirection is not available for ASP targets.

The following drawing illustrates how parameters get processed in a 4GL JSP application when a server redirection displays another page. Parameters are passed the same way for JSP targets, except for the application server name. Also, the target and linking pages in a JSP application would typically have .jsp extensions instead of the .htm extensions displayed in the drawing:

Figure 10-3: Passing parameters in a server redirect

The illustration shows a Client browser with a page labeled p 1 dot h t m. The client browser sends to the server a page form submitted for self navigation with redirection to P w dot h t m. The server redirects P 1 dot h t m to P 2  dot h t m. Parameters and variables are available on the server.

Setting up a server redirection

You can set up a server redirection from the integrated Script editor by selecting a server event, then specifying the target page and the parameters to pass to that page. The script is created for you.

StepsTo set up a server redirection from the integrated Script editor:

  1. In a server script or in the script for a control with a server action event selected in the events list, right-click in the Script editor.

  2. Select Insert Redirect from the pop-up menu.

  3. In the Redirect Properties dialog box, specify the target file or URL.

  4. Specify the target page parameters, the type of binding for each parameter, and the value you want to bind to the parameter.

    If the target page exists with input parameters identified for it, these parameters appear in the list of parameters on the Redirect page. You can edit these parameters and add new ones.

    Shown is the Redirect tab page of the Redirect Properties dialog box. At top is a Destination text box with a browse button and the entry Customer dot h t m. Next are columns for Parameter Name, Bind Type, and Bind Value. Four rows of sample entries read Cust Number, Constant, 101, then Order Number, Page Parameter, Selected Order, then param 1, Page Variable, var 1, then param 2, NONE, and blank.
  5. When you finish setting the Redirect Properties, click OK.

    The Script editor inserts a block of code. You can modify or remove this block of code using the pop-up menu.

Changing parameter bindings

You can change the binding for parameters from the Redirect Properties dialog box.

StepsTo change parameter bindings or parameter values for a server redirection:

  1. Right-click in the Redirect code in the integrated Script editor.

  2. Select Edit Redirect from the pop-up menu.

  3. In the Redirect Properties dialog box, make any changes needed to the parameter definitions.