Velocity Portlets in the Registry

There is no need to extend this portlet class, just define your porlet entry in the registry as a child of this class and provide your template and action class (extended from GenericMVCAction) and you are good to go.

Velocity Portlets are defined like any other portlet: in the portlet registry. In tutorial 7 we define two new portlets:



<portlet-entry name="TutorialStockQuote1" hidden="false" type="ref"  
               parent="Velocity" application="false">
...
        <parameter name="template" hidden="true"
                   value="tutorial-stock-quote1"/>
        <parameter name="action" hidden="true"
                   value="portlets.TutorialStockQuoteAction1" />
...
    </portlet-entry>

    <portlet-entry name="TutorialStockQuote2" hidden="false" type="ref" 
                   parent="Velocity" application="false">
...
        <parameter name="template" hidden="true"
                   value="tutorial-stock-quote2" />
        <parameter name="action" hidden="true"
                    value="portlets.TutorialStockQuoteAction2" />
...
</portlet-entry>

When defining a Velocity portlet, there are two required parameters: the template and the action. The template defines the Velocity template which will generate the portlet content. It is your MVC View component. The action is the controller, and it has several responsibilities including handling action events and populating the context. The templates should be placed in the portlets subdirectory of one of your Velocity template paths. The action is placed in the module path, conventionally under the portlets directory of the root actions directory.

Also note that a Velocity portlet can derive from one of two Velocity portlets: Velocity or CustomizerVelocity. The only difference being that the Velocity portlet uses the default Jetspeed portlet customizer, where as the CustomizerVelocity portlet is expected to provide its own customization. Look at the Weather Portlet as an example of a CustomizerVelocity portlet providing its own customization.



<portlet-entry name="TutorialStockQuote1" hidden="false" type="ref" 
                   parent="Velocity" application="false">

...
</portlet-entry>

    <portlet-entry name="WeatherPortlet" hidden="false" type="ref"
        parent="CustomizerVelocity" application="false" >
...
</portlet-entry>