Tag: url

The wcf:url tag builds a URL and applies the appropriate WebSphere Commerce supported rewriting rules. The wcf:url tag contains the following additions in comparison to the c:url tag:

Tag information
Body Content empty


Attributes

Attribute Required Request-time Type Description
var false true java.lang.String The name of the exported scoped variable for the processed URL.
value true

true java.lang.String The URL to process or the mapped name used in the SEOUrlMapper.xml file.
patternName false true java.lang.String The pattern name that is defined within the pattern template files. This pattern is used to construct the SEO URL. The value can be equal to the name attribute of the patterns that are defined for the store.
context false true java.lang.String The name of the context when you specify a relative URL resource that belongs to a foreign context.
scope false true java.lang.String The scope for the variable specified by var.
type false true java.lang.String Specifies whether the current URL is used in an Ajax call. Valid type values are Ajax or Base. Default is Base. If the type value is Ajax, the scheme for the URL is taken from the current request, rather than from the Struts configuration file.

Note: Either the value or patternName attribute is required. If workspaces are used, both the value and patternName are required. If the value attribute and the patternName attribute is provided and SEO is enabled in the wc-server.xml file as shown in the following example, then the URLs are constructed using the pattern template definitions. Preference is given to the patternName attribute over the value attribute when both attributes are specified.

If URL construction using the patternName attribute fails (as a result of an invalid patternName or a missing parameter), dynamic URLs are constructed when the dynamicUrl attribute is set to true. If the dynamicUrl attribute is set to false, then wcf:url tag returns the defaultUrl value specified in the wc-server.xml file.

The URL creation order is:

  1. If SEO is enabled and the patternName attribute is specified, the patternName attribute constructs a new SEO URL.

    1. If a new SEO URL construction fails and dynamicUrl = true, a dynamic URL is constructed.

    2. If dynamicUrl = false, a defaultUrl is constructed

  2. Otherwise, the value attribute is used and an older style SEO URL is constructed.


Variables

No variables are defined for the wcf:url tag.


Example

The following example forms a URL to display the shopping cart using the wcf:url tag. It specifies the URL type as an Ajax call.