OpenWGA 7.6 - OpenWGA Concepts and Features

Design and development » WebTML » Basic concepts

URL parameters

To parametrize your WebTML page you can also use URL parameters. They have the benefit of being "semi-persistent" as they stay on the URL of the current page and will survive reloads of that page. They will only be gone when the user leaves the page.

There are two ways of using URL parameters in WebTML: Using regular URL parameters or using URL parameters to define WebTML variables.

Using regular URL parameters

A regular URL parameter is just a cleartext parameter added to the URL, like known and used widely on webpages. They have the benefit of being user-readable and easily modifyable. Note however that this also may be a drawback regarding security. Users may modify URL parameters any possible way and try to hijack application security by that.

You can generate URLs to OpenWGA resources and let them carry regular URL parameters. The preferred way to do this is to use WebTML tag <tml:param> inside <tml:url> and giving it the type "url":

<tml:url type="layout" name="main">

  <tml:param type="url" name="view">showissues</tml:param>

</tml:url>

This likely will generate a URL like the following:

http://myhost.com/myapp/html/default/main.en.html?view=showissues

When this URL gets called you can retrieve the URL parameter value either by WebTML tag <tml:urlparam> or in TMLScript via "this.request.getParameter()":

Current issue is: <tml:urlparam name="issueid"/>


<tml:range context="[name:issues.{request.getParameter('issueid')}]">


  ....


</tml:range>

It is generally discouraged to simply append a URL parameter to a generated URL by adding it as simple text after the generation, like demostrated here:

<tml:url type="layout" name="main">?view=showissues

The generated URL may contain URL parameters by itself so the following code would not know if it should append additional parameters via "?" or "&". The result may be something like the following, which does not work:

http://myhost.com/myapp/html/default/main.en.html?generatedparam=value?view=showissues

Using URL parameters to define WebTML variables

You can use roughly the same code to generate a URL that will create a WebTML variable "view" instead. Just use type="var" instead or leave the type attribute out, as this is the default:

<tml:url type="layout" name="main">

  <tml:param name="view">showissues</tml:param>

</tml:url>

This will generate a URL containing a special URL parameter "$vars". This parameter contains the values of all parameters that are defined that way in an encrypted form:

http://myhost.com/myapp/html/default/main.en.html?$vars=L2h0bWwvaG9tZS5pb...

The benefit is obvious: Users are not able to modify these parameters. They only have the possibility to leave it like it is or to remove the complete parameter, therefor removing all WebTML variables alltogether. Also the parameter is bound to the URL which it is generated for. It may not be used on another URL.

When the URL gets called you can simple retrieve the generated WebTML variables by the known ways. For example:

<tml:item name="view"/>


<tml:case condition="view == 'showissues'">

  ...

</tml:case>

When OpenWGA keeps URL parameters from previous requests

When generating URLs to other resources OpenWGA generally does not reuse URL parameters from the current request. On most URL forms generated by <tml:url> you can however explicitly let it keep them by specifying attribute keepparams="true".

There are however some special cases where OpenWGA keeps URL parameters by default. These cases have in common that their call represent the execution of a functionality on the current page rather than moving to another page. These cases are: