Portlet Configuration How To Velocity

Velocity

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

Present content rendered via a Velocity template in a portlet.

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

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 Name Description
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.
Customize portlet org.apache.jetspeed.portal.portlets.VelocityPortlet

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

Variable Name Description
General URL
$jslink Link to current page.
$jslink.HomePage Link this Jetspeed installation's Home Page.
Templates in the URL
$jslink.getTemplate Link 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.ActionKey The 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.Page Link 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.Anonymous true is the user is NOT logged in, otherwise false.
$jslink.GroupName Name of the current group, or "null" if not a group page.
$jslink.RoleName Name of the current role, or "null" if not a role page.
$jslink.UserName Name of the current user, or "null" if not a user page.
$jslink.PageName Name of the current page.
$jslink.MediaType MediaType of the current page.
$jslink.Country Country of the current page.
$jslink.Language Language 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.

Jetspeed include the following example of Velocity porlets.

Portlet Name Description
HelloVelocity Basic Velocity portlet
JSLINK Example Display the uses of $jslink