Redirect

Redirects the client’s browser to another page.

To redirect

Use

From a 4GL Web page

Syntax 1 For 4GL Web pages

From a Web page that is not 4GL Web-enabled

Syntax 2 For pages not 4GL Web enabled


Syntax 1 For 4GL Web pages

Description

Redirects the client’s browser to another page. Use this method to navigate programmatically to a new page. This method is for 4GL JSP targets only.

Applies to

psPage object

Syntax

psPage.Redirect ( string destination, PSArgClass argument )

Argument

Description

destination

This must be a URL.

argument

If you do not use null for this value, you must construct an object with PSArgClass and call the addArg method on that object to add parameter names and values.

Returns

None

Usage

You define the parameters that you pass in the PSArgClass object. The Redirect method calls the GetParameterString method on the PSArgClass object to return a URL-encoded string.

If a redirect is done before HTML generation starts, HTML generation will not occur but will still trigger the RequestFinish event. If called in or after the BeforeGenerate event, generation will complete, but the generated page will not be sent to the client browser.

If Redirect is called more than once, earlier calls to this method are overwritten. Only the last call will have any effect.

Examples

Example 1

This example uses the Redirect method with parameters, where “param1” is a parameter defined on the Parameters tab of the Page Properties dialog box:

PSArgClass myParam=null;
myParam = new PSArgClass();
myParam.addArg("param1", param1);
psPage.Redirect("page_2.jsp", myParam);

Syntax 2 For pages not 4GL Web enabled

Description

Redirects the current request to another URL.

Applies to

PSDocumentClass object

Syntax

psDocument.Redirect( URL )

Argument

Description

URL

The URL to which the current request is being directed

Returns

None.

Usage

At runtime, Redirect has the following behavior:

Application server

Runtime behavior

ASP

Sets the value of the redirect property of the document object

JSP

Calls the sendRedirect method on the response object

Examples

Example 2

The following example redirects the current request to the Sybase Web site:

psDocument.Redirect("http://www.sybase.com");