Jetspeed

ApacheCon US 2003 -- Join US!

Essentials

Download

Documentation

Components

Translated

Get Involved

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 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.


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.

Context Classname Description
action String Class name to process form
conf org.apache.jetspeed.portal.PortletConfig  
config org.apache.jetspeed.services.resources.JetspeedResources  
data org.apache.jetspeed.services.rundata.JetspeedRunData  
jetspeed org.apache.jetspeed.util.template.JetspeedTool  
jslink org.apache.jetspeed.util.template.BaseJetspeedLink  
l10n org.apache.turbine.services.localization.LocalizationTool Language specific text
portlet org.apache.jetspeed.portal.portlets.AbstractPortlet Use portlet_instance whenever possiable
portlet_instance org.apache.jetspeed.portal.PortletInstance  
skin org.apache.jetspeed.portal.PortletSkin  
template String Name of Velocity template

jslink
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.


Example of Portlets

Jetspeed include the following example of Velocity porlets.

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



Copyright © 1999-2003, Apache Software Foundation