Home > Contents > Index >
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index
render:gettemplateurl
Generates a valid URL to an asset, rendered through a template, with optional wrapper page support. User-defined arguments will be packed if wrapperpage is specified. A vanity URL will be used if available.
Syntax
<render:gettemplateurl outstr="theURLVariable" c="asset type" cid="asset id" tname="target Template name" [d="Device Group Suffix"] [resolvetemplatefordevice="A boolean value indicating whether parameter 'd' should be ignored or not."] [wrapperpage="name of uncached wrapper page"] [addsession="true|false"] [assembler="uri assembler shortform"] [authority="authority value"] [container="servlet|portlet"] [deptype="exists|none"] [dynamic="true|false"] [fragment="fragment value"] [packedargs="stringFromPACKARGStag"] [args="variable1,variable2,..."/>] [satellite="true|false"] [scheme="scheme value"] [site="site name"] [tid="caller Template or CSElement id"] [ttype="caller Template or CSElement"] [webrootname="webroot%quot;] /> [<render:argument name="variable1" value="value1"/>] </render:gettemplateurl>Attributes
outstr
(required)- Input. Name of the variable that stores the URL generated by this tag.
c
(required)- The asset type which will be rendered using the referenced template, that will be the target of the URL generated. The value of this attribute will be specified on the URL.
cid
(required)- The asset id which will be rendered using the referenced template, that will be the target of the URL generated. The value of this attribute will be specified on the URL.
tname
(required)- The name of the Template to be called.
d
(optional)- Device Group Suffix(a string that is common suffix of all the templates written for current device group). For example, if d ='Touch' and parameter tname = 'HomeLayout', the tag will try to find a template with name tname_d i.e. HomeLayout_Touch. If it exists, the tag will return the url of this template, otherwise will simply return the url of the template 'HomeLayout' i.e. actual tname provided.
resolvetemplatefordevice
(optional)- true|false. Default is true. If 'false' is provided explicitly, the tag will ignore the parameter 'd' and will not try to find the device group specific template
wrapperpage
(optional)- Input. If the target uses an uncached wrapper page, supply this argument with the name of that SiteCatalog page. The pagename argument will be passed as "childpagename". Please note that when using the wrapperpage parameter, non standard arguments are passed as
packedargs
. Such arguments will need to be unpacked before accessing. Standard arguments such asc
,cid
, andp
will be preserved and not packed.addsession
(optional)- Input. Whether or not to include session IDs in the URL when a browser is set to reject cookies.
true
means to encode session IDs in the URL. If this parameter is not specified, it is set totrue
by default.assembler
(optional)- Short form name for uri assembler class. Specifying an assembler overrides the default assembler used by Sites to construct URLs. Omitting this value will cause URLs generated by this tag to use the assembler registered with the highest priority in the request property file.
authority
(optional, required if scheme is set)- Attribute that allows the user to specify a fully-qualified URL, when used in conjunction with
scheme
. URLs are of the formscheme://authority/path?query#fragment
. For most purposes, authority corresponds tohost:port
for the given application. Specifyingscheme
andauthority
allows for fully-qualified URLs to be created, which is useful for sites with multiple domains and in other cases.container
(optional)- Override attribute that specifies whether the URL will be generated for a servlet container or a portlet container. By default, the current container will be used. For practical purposes, leaving this blank or setting it to
servlet
should be sufficient. Legal values areservlet
andportlet
.deptype
(optional)- Input. This attribute specifies whether approval dependency is
exists
, ornone
.exists
(default) specifies that any version of the asset satisfies the dependency condition;none
specifies no approval dependency on the asset.dynamic
(optional)- Input. Whether to create a static or a dynamic URL for the asset when the page is being rendered by the Export to Disk publishing method.
true
means to create a dynamic URL even ifrendermode
is set toexport
.false
means to create a static URL ifrendermode
is set toexport
. If this parameter is not specified, it is set tofalse
by default.fragment
(optional)- Optional attribute to specify a fragment on the URL. Fragments, sometimes known as anchors, allow browsers to advance to a specific location in a single web page. ex.
http://www.myhost.com/foo.html#thirdParagraph
.packedargs
(optional)- This attribute contains a series of arguments (name-value pairs) URL-encoded as a string.
args (optional)
- A comma-separated list of Sites variables to be passed as arguments
satellite
(optional)- Override attribute that forces the URL generated to be a URL for either Satellite Server or Sites. By default, the URL will automatically be set to whatever the containing page is set to. Legal values are
true
(Satellite Server URL) andfalse
(Sites URL).scheme
(optional, required if authority is set)- Attribute that allows the scheme to be set in the URL. The scheme in the case of most URLs refers to the protocol and is usually set to either
http
orhttps
. If this is left blank (andauthority
is left blank) then the URL will be relative to the current scheme and authority.site
(required)- The name of the site containing the Template to be referred to by the URL.
tid
(required)- The id of the template in which this tag is located. If this tag is located in a CSElement, then the value of this attribute should be the id of the CSElement, and
ttype
should be set toCSElement
.ttype
(optional)- This attribute identifies whether the code that contains this tag is a
Template
or aCSElement
. The default value isTemplate
, andCSElement
is the other legal value. Seetid
.webrootname
(optional)- Name of WebRoot to be used for retrieving vanity URL.
Parameters
- render:argument (optional)
- Nested parameter tag. The render:gettemplateurl tag allows arbitrary argument tags to be added in order to add name/value pairs to the URL to be generated.
Description
This tag is the preferred method for generating a URL to an asset (provided that the asset is being rendered through a Template, which is the recommendation). It effectively replaces
render:getpageurl
in most (but certainly not all) cases.Instances of this tag must contain information about who the caller is in order to operate correctly. The caller must be either another Template or a CSElement. This tag will not operate correctly without valid information about the caller. (see
tid
&ttype
above).
render:gettemplateurl
operates in two modes: explicit mode and context mode.In explicit mode,
c
,cid
, andtname
are explicitly specified as attributes to the tag. In essence, the asset identified byc
andcid
will be the subject of the URL along with the template namedtname
. If tname starts with "/
" then the typeless template corresponding totname
will be used. Otherwise, the template corresponding to the specifiedtname
and asset type ("c
") will be called. Usually, the template name will correspond to a typeless layout template, which will dispatch to typed templates to render the actual asset. Explicit mode is the only mode that is currently supported.In context mode, the
context
attribute (which defaults to an ICS variable of the same name if not present) will be examined to determine the template and asset to paired in the URL. Context mode support is not currently enabled in the Sites interface, however future versions may include it.Error Numbers
The possible values of
errno
include:
Value Description -10004 A required parameter is missing .Example
The following example is the entire content of the FirstSite Mark II Product_C Link template. It constructs a URL back to the specified product through an uncached wrapper and a layout template.
In this tag, most of the attribute values are set from other variables in the variable space, either because they have been passed in, or because they have been explicitly looked up. The following table describes the origin of the ICS variables referenced below.
Variable origins Variable name Origin site The site
variable is set as a resarg in all of the templates and SiteEntry assets. As such, it can be expected to be set correctly to the name of the current site.tid The tid
variable is set in the resargs of the called template. Because this code is in a Template, thetid
attribute is set to the value of thetid
variable. If this code had been located in a CSElement, this attribute would have been set to the value of theeid
variable and thettype
attribute would also have been set toCSElement
. See above for details.c The c
variable is specified on the URL and is passed unchanged into the Layout template.cid The cid
variable is specified on the URL and is passed unchanged into the Layout template.p The variable p
is specified on the URL and is passed unchanged into the Layout template.<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld" %><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld" %><%@ taglib prefix="render" uri="futuretense_cs/render.tld" %><%@ taglib prefix="string" uri="futuretense_cs/string.tld" %><%@ taglib prefix="assetset" uri="futuretense_cs/assetset.tld"%><cs:ftcs> <%-- Record a compositional dependency for the template so that pagelets generated by this template are managed properly --%> <ics:if condition='<%=ics.GetVar("tid")!=null%>'> <ics:then> <render:logdep cid='<%=ics.GetVar("tid")%>' c="Template"/> </ics:then> </ics:if> <%-- Create an assetset so we can retrieve values from this asset for use in the link --%> <assetset:setasset name="ProductSet" type='<%=ics.GetVar("c")%>' id='<%=ics.GetVar("cid")%>' /> <%-- Look up the attribute type name (we know it is Product_A but for replication support we must look it up --%> <render:lookup key="ProductAttrType" varname="ProductAttrType" site='<%=ics.GetVar("site")%>' tid='<%=ics.GetVar("tid")%>'/> <%-- Look up the name of the name attribute (we know it is "name" but for replication support we must look it up --%> <render:lookup key="NameAttrName" match=":x" varname="NameAttrName" site='<%=ics.GetVar("site")%>' tid='<%=ics.GetVar("tid")%>'/> <%-- Retrieve the name of the product --%> <assetset:getattributevalues name="ProductSet" attribute='<%=ics.GetVar("NameAttrName")%>' listvarname="NameList" typename='<%=ics.GetVar("ProductAttrType")%>' /> <%-- Look up the name of the layout template and of the wrapper SiteEntry --%> <render:lookup site='<%=ics.GetVar("site")%>' varname="LayoutVar" key="Layout" tid='<%=ics.GetVar("tid")%>'/> <render:lookup site='<%=ics.GetVar("site")%>' varname="WrapperVar" key="Wrapper" tid='<%=ics.GetVar("tid")%>' match=":x"/> <%-- Construct a standard URL for this product. The layout template will dispatch to the typed tempmlate that will render this product in its detailed view. --%> <render:gettemplateurl outstr="aUrl" c='<%=ics.GetVar("c")%>' cid='<%=ics.GetVar("cid")%>' tname='<%=ics.GetVar("LayoutVar")%>' wrapperpage='<%=ics.GetVar("WrapperVar")%>' > <render:argument name="p" value='<%=ics.GetVar("p")%>'/> </render:gettemplateurl> <%-- Render the link. Be sure to stream the name and URL using the render:stream tag in order to ensure xhtml-compliance of the response --%> <a href='<string:stream variable="aUrl"/>'> <string:stream list='NameList' column="value" /> </a> </cs:ftcs>See Also
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.