OneTrip

Description

Generates HTML syntax for the Web DataWindow after setting values that refresh the state of the server component so that it is in sync with user actions.

NoteOneTripEx A separate method name is provided as an alternative syntax because the Web DataWindow server component cannot use overloaded methods.

Applies to

DataWindow type

Method applies to

Web

Server component

Syntax

Web DataWindow server component

string dwcomponent.OneTrip ( string htmlobjectname, string browser,
	string selflink, string selflinkargs, string action, string context )
string dwcomponent.OneTripEx ( string htmlobjectname, 
	string retrievalargs, string browser, string selflink, 
	string selflinkargs, string action, string context )


Argument

Description

dwcomponent

A reference to a Web DataWindow server component

htmlobjectname

A string specifying a name used in generated code for the Web DataWindow client control, page parameters, and client side events. You must specify a unique object name when there is more than one Web DataWindow on a Web page.

retrievalargs

A string that contains the values of the retrieval arguments expected by the DataWindow object associated with the server component (see Usage note).

browser

A string identifying the browser and version. The value should match the browser information passed to the Web server in the HTTP header. The corresponding server variable is HTTP_USER_AGENT.

Sets the value of the HTMLGen.Browser property for the DataWindow object associated with the server component.

For information on recognized browsers, see HTMLGen.property.

selflink

The URL for the current page. It cannot include parameters. Parameters from selflinkargs may be added when HTML is generated.

The server component uses SelfLink to generate URLs for navigation buttons that obtain additional rows from the result set.

Sets the value of the HTMLGen.SelfLink property for the DataWindow object associated with the server component.

selflinkargs

A string in the form:

argname='exp'{ | argname = 'exp' } ... 

Argname is an argument passed to the server.

Exp is a DataWindow expression whose value is a string. The DataWindow in the server component evaluates it, converts it using URL encoding, and includes in the selflinkargs string.

Sets the value of the HTMLGen.SelfLinkArgs property for the DataWindow object associated with the server component.

action

A string describing an action associated with a button click or method call in a Web DataWindow client control on a Web page. The value of action is stored in a page parameter called htmlobjectname_action.

context

A string describing the context of action in the Web DataWindow client control. The string is generated by a Web DataWindow script and the value is stored in a page parameter called htmlobjectname_context.

The format is not documented and subject to change.

Returns

Returns the generated HTML if it succeeds and an error message if any of the requested settings fails.

Usage

OneTrip and OneTripEx perform the tasks of SetSelfLink, SetBrowser, Retrieve, SetAction, and Generate in a single method. They are meant to be used with an EAServer component that has been previously configured with a DataWindow definition and transaction information. Using OneTrip produces maximum performance for the Web DataWindow client while allowing the server component to remain stateless.

Use OneTripEx instead of OneTrip if you need to specify retrieval arguments. The retrievalargs string in the OneTripEx syntax has the format:

value1 \n value2 \n value3... \n value16

The values of the retrieval arguments must be separated by newline characters (\n) and individual values cannot contain newline characters as part of the value. The Web DataWindow supports up to 16 retrieval arguments.

You can specify an array for the value of a retrieval argument by separating the array values with a tab character (\t). For example, if the DataWindow expected an array for the second retrieval argument, the syntax would be:

value1 \n value2a\t value2b \t value2c \n value3... 

If the script gets the values for the retrieval arguments from page parameters, you must also specify the retrieval arguments as selflinkargs expressions, so that the values will be available as page parameters when the page is reloaded.

The evaluated selflinkargs expressions are included in the generated HTML as hidden fields and are available to server-side scripts as page parameters. You can use the arguments to supply information that the server component needs to render additional pages of the result set, such as retrieval arguments. Selflinkargs can also be used to keep login information or other data available that was passed in the original call to the page.

For information on quotation marks and other formatting for the expression, see the SetSelfLink method. For information about using the Web DataWindow, see the DataWindow Programmers Guide.

Examples

Example 1

This Web Target server-side script uses OneTripEx to get generated HTML. The DataWindow object expects two retrieval arguments, an employee ID and a salary:

function GetParam( envparam ) {

		if( exists(document.value[envparam] ) )  {

			return document.value[envparam];

		}

		return "";

};


// Create component on server

dwMine = java.CreateComponent("DataWindow/MyVersion",

		"iiop://testMachine:9000", "jagadmin", "",

		"DataWindow/HTMLGenerator110");


// Get information about user’s latest button click

var action = psDocument.GetParam("dwMine_action");

var context = psDocument.GetParam("dwMine_context");


// Get browser and hyperlinking information

var browser = psDocument.GetEnv("HTTP_USER_AGENT");

var selfLink = psDocument.GetEnv("SCRIPT_NAME");


// Get retrieval arguments from page parameters

var args = "" + psDocument.GetParam("arg_empid") + "\n" + psDocument.GetParam("arg_salary");


// Set up page parameters for reloaded page

linkargs = "arg_empid =’\"" +

			psDocument.GetParam("arg_empid") + "\"’"

		+ "|arg_salary= ’\"" +

			psDocument.GetParam("arg_salary") + "\"’";


// Include the generated HTML in the Web page

psDocument.Write(dwMine.OneTripEx("dwMine", args,

		browser, selfLink, linkargs, action, context) );

See also