Velocity


Class Name : org.apache.jetspeed.portal.portlets.VelocityPortlet


Description

Present content rendered via a Velocity template in a portlet.

Additional information about Velocity is available at http://jakarta.apache.org/velocity

Element: parameter

Only the template parameter is required. If the "action" parameter is defined, the referenced class may require additional parameters.

Parameters common to many portlets.

Parameter NameDescription
action Name of action class, relative to org.apache.jetspeed.modules.actions. The class file is expected in <jetspeed_home>WEB-INF/classes/org/apache/jetspeed/modules/actions.

This parameter is optional.
template Name of VM file. The file is expected in <jetspeed_home>WEB-INF/templates/vm/media_type.

Example of Registry Entry

<portlet-entry name="PortletCustomizer"
               hidden="true"
               type="instance" application="false">
  <security role="user"/>
  <meta-info>
    <title>Customize portlet</title>
  </meta-info>
  <classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classname>
  <parameter name="template" value="customizer-portlet" hidden="false"/>
  <parameter name="action" value="portlets.CustomizeAction" hidden="false"/>
</portlet-entry>

Context or Variables available to a Velocity Template

Below is a list variables that can be used in the Velocity template file. Their values are defined by Jetspeed. For a list of properties and methods available, refer to the Classname documentation.

ContextClassnameDescription
actionStringClass name to process form
conforg.apache.jetspeed.portal.PortletConfig
configorg.apache.jetspeed.services.resources.JetspeedResources
dataorg.apache.jetspeed.services.rundata.JetspeedRunData
jetspeedorg.apache.jetspeed.util.template.JetspeedTool
jslinkorg.apache.jetspeed.util.template.BaseJetspeedLink
l10norg.apache.turbine.services.localization.LocalizationToolLanguage specific text
portletorg.apache.jetspeed.portal.portlets.AbstractPortletUse portlet_instance whenever possiable
portlet_instanceorg.apache.jetspeed.portal.PortletInstance
skinorg.apache.jetspeed.portal.PortletSkin
templateStringName of Velocity template


jslink

Variable NameDescription
General URL
$jslinkLink to current page.
$jslink.HomePageLink this Jetspeed installation's Home Page.
Templates in the URL
$jslink.getTemplateLink to the current page using the current template.
$jslink.getTemplate( Template Name )Link to the current page using a named template.
Path and Query item on URL
$jslink.addPathInfo( Path Item, Item Value )Link to the current page with an additional path item.
$jslink.addQueryInfo( Query Item, Item Value )Link to the current page with an additional query item.
Actions items in the URL
$jslink.ActionKeyThe name if the action query item.
$jslink.getAction( Action Name )Link to current page with an action item.
$jslink.getAction( Action Name, Portlet ID )Link to current page with an action item and a Portlet ID (PEID).
Group/Role/User/Page element on URL
$jslink.getGroup (Group Name )Link to the default page in a group.
$jslink.getGroup( Group Name, Page Name )Link to the page in a group.
$jslink.getRole (Role Name )Link to the default page in a Role.
$jslink.getRole( Role Name, Page Name )Link to the page in a Role.
$jslink.getUser (User Name )Link to the default page for the User.
$jslink.getUser( User Name, Page Name )Link to a page for the User.
$jslink.PageLink to the default page for the current user, group, or role.
$jslink.getPage( Page Name )Link to page for the current user, group, or role.
Pane items in the URL
$jslink.getPaneById( Pane ID )Link to a pane, using it's PEID, in the current page.
$jslink.getPaneByName( Pane Name ) Link to a pane, using it's name, in the current page. This should be used with caution since the name may not be unique.
$jslink.getPortletById( Portlet ID )Link to a portlet, using it's PEID, in the current page.
Portlet items in the URL
$jslink.getPortletByName( Portlet Name ) Link to a portlet, using it's name, in the current page. This should be used with caution since the name may not be unique.
Information about the PSML Document
$jslink.Anonymoustrue is the user is NOT logged in, otherwise false.
$jslink.GroupNameName of the current group, or "null" if not a group page.
$jslink.RoleNameName of the current role, or "null" if not a role page.
$jslink.UserNameName of the current user, or "null" if not a user page.
$jslink.PageNameName of the current page.
$jslink.MediaTypeMediaType of the current page.
$jslink.CountryCountry of the current page.
$jslink.LanguageLanguage of the current page.
setLink()
$jslink.setLink(.....) A way to define a link that allows many paramters. See the javadocs for org.apache.jetspeed.util.template.JetspeedLink or the JSLINK Example portlet.

Example of Portlets

Jetspeed include the following example of Velocity porlets.

Portlet NameDescription
HelloVelocityBasic Velocity portlet
JSLINK Example Display the uses of $jslink