Download

Get Loom

Url tag

This tag is used to print links:

<%-- 

  <a href="/webcontext/blog-entries/open/1?foo=${foo}"> 

--%>
<l:url action="BlogEntries" event="open">
   <l:param name="id" value="1"/>
   <l:param name="foo" value="${foo}"/>
</l:url>

<%-- 

  Equivalent code

--%>
<l:url mapping="BlogEntries.open" param-id="1" param-foo="${foo}"/>

If the event name is omitted, the default Event will be used. Any nested <param> tag with a not null value will be appended to the resulting url.

In this example the tag contents has not been specified. In this case the translated text corresponding to the concatenation of action and event (here, BlogEntries.save) will be used. This may be overriden by adding a "title" attribute or by including text contents inside the link.

Notice that "mapping" short version can also be used with any tag that accepts an action/event pair such as form, tab, menuItem or redirect.

URLs may also be specified using a href attribute, which will be prefixed by the web context automatically.

<%-- 

   <a href="/webcontext/some.jsp?entity.id=${action.entity.id}">Click to go there

--%>
<l:url href="/some.jsp">
   Click to go there
   <l:param property="entity.id"/>
</l:url>

Links can be memorized in a scoped var if the "var" argument is not null, in which case nothing will be written to the rendered html page.

If the decorator is set to "link-only" only the link will be written with no surrounding tag.