SetSelfLink (obsolete)
Description
Specifies the URL and page parameters for the current page of the
Web DataWindow.
Obsolete method
SetSelfLink is obsolete and should not be used, because the Web
DataWindow technology is obsolete.
Applies to
|
DataWindow type |
Method applies to |
|---|---|
|
Web |
Server component |
Syntax
Web DataWindow server
component
|
1 |
string dwcomponent.SetSelfLink ( string selflink, string selflinkargs ) |
|
Argument |
Description |
||
|---|---|---|---|
|
dwcomponent |
A reference to an Web DataWindow server |
||
|
selflink |
The URL for the current page. It cannot include Selflink is used to generate URLs for Sets the value of the HTMLGen.SelfLink |
||
|
selflinkargs |
A string in the form:
Argname Exp is The evaluated selflinkargs expressions are |
Return value
Returns an empty string if successful and the syntax error message
from the Modify method if it fails.
Usage
This method calls the Modify method of the server component’s
DataStore to set the property.
Reason for self-link
information
The first time the client browser requests the page template, it can
pass page specific information using GET or POST and the page can use
those values in the server-side scripts. However, when the page is
reloaded because of user interactions with the Web DataWindow, that
information will not be passed to the page automatically.
To make the information available, you specify a selflinkargs string
that becomes page parameters in the reloaded page. Typically, you would
use self-link parameters to provide:
-
Login information from another page
-
DataWindow object name
-
Retrieval arguments for the DataWindow object
Getting the URL for the page
To correctly reload the page in response to user actions, the server
component needs to know the URL of the page template. You can get this
information from the name property of the document object header or the
SCRIPT_NAME server variable.
In a JSP page, you must parse the return value from a
request.getRequestURI call:
|
1 2 3 |
String URI = request.getRequestURI(); String [] myArray = URI.split ("/"); String pageName = myArray [myArray.length-1]; |
In ASP, use the ServerVariables method of the Request object:
|
1 |
var pageName =Request.ServerVariables( "SCRIPT_NAME" ); |
Self-link arguments for
SetSelfLink
The syntax for specifying self-link arguments is:
|
1 |
pageparam='expression'|pageparam='expression' |
The expression is a DataWindow expression that is evaluates to a
string. Usually, you will be passing constant string values that have
already been passed to the page as page parameters.
The expression is enclosed in quotes, and if the value is a
constant, it must also be enclosed in quotes. For example, if a page
parameter has the value Johnson, the value of the expression must be
enclosed in two sets of quote marks: ‘”Johnson”‘.
To get the value from the current Logname parameter, which is
already defined for the page, you build the expression using the Logname
page parameter. The single quotes and inner double quotes are embedded in
the expression. The current value is inserted between the quotes:
|
1 2 |
String logname = (String) request.getParameter("Logname"); String linkargs = "logname='"" + logname + ""'"; |
If the DataWindow object requires retrieval arguments, they must be
provided to the reloaded page in selflinkargs. For an example of using
SetSelfLink for setting up retrieval arguments as page parameters, see
Retrieve.
Examples
This server-side script specifies hyperlink information for the
page. The value of the empid column is stored in the page parameter
EMPID:
|
1 |
webDW.SetSelfLink("mydwpage.html", "EMPID = 'String(empid)'"); |
This hyperlink information refers to the JSP page by name. The page
is regenerated by calling the template again. There are no link
arguments:
|
1 |
webDW.SetSelfLink("salesrpt.jsp", ""); |
This ASP example uses the ServerVariables method of the Request
object to get the SCRIPT_NAME variable:
|
1 2 |
var pageName = Request.ServerVariables( "SCRIPT_NAME" ); webDW.SetSelfLink(pageName,""); |
In JSP you must parse the return value from a request.getRequestURI
call. This example also sets up a page parameter for the reloaded page
using the page parameter Logname:
|
1 2 3 4 5 6 |
String URI = request.getRequestURI(); String [] myArray = URI.split ("/"); String pageName = myArray [myArray.length-1]; String logname = (String) request.getParameter("Logname"); String linkargs = "Logname='"" + logname + ""'"; webDW.SetSelfLink( pageName, linkargs); |
See also