setParameter (XSPUrl - JavaScript)

Sets the value of a query string parameter.

Defined in

XSPUrl (JavaScript)

Syntax

setParameter(name:string, value:string) : void
Parameters Description
name The name of an existing or new parameter.
value A value for the parameter.

Usage

This method resets the value for an existing parameter, or adds a new parameter.

Example

This example sets the parameters for the query string of a new URL.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var url : XSPUrl;

try {
	url = new XSPUrl("");
	url.setScheme("http");
	url.setHost("myhost.ibm.com");
	url.setPort(10038);
	url.setPath("/wps/PA_cow3tik/page1.xsp");
	url.setParameter("WP_BUSINESS_OBJECT_DATA", "rp0707test1");
	url.setParameter("WP_BUSINESS_OBJECT", "ejb/com/ibm/component/designer/ejb/DesignerComponent");
	url.setParameter("action", "openDocument");
	url.setParameter("database", "rp0707test1");
	url.setParameter("schema", "Schema_form1");
	url.setParameter("id", "3fb66696c9e31");
	url.setParameter("autoedit", "true");
	p(url.toString());

} catch(e) {
	p("Error = " + e);
}

Print output from the example is as follows:

<<<http://myhost.ibm.com:10038/wps/PA_cow3tik/page1.xsp?WP_BUSINESS_OBJECT_DATA=rp0707test1&WP_BUSINESS_OBJECT=ejb%2Fcom%2Fibm%2Fcomponent%2Fdesigner%2Fejb%2FDesignerComponent&action=openDocument&database=rp0707test1&schema=Schema_form1&id=3fb66696c9e31&autoedit=true>>>