Developing the Jetspeed framework

Developing portals based on the Jetspeed framework

Developing components for Portal servers (platform independent)

Portlet Development: developing a JSR 168 Portlet platform independent

Developing components that are Jetspeed portal dependent

Developing a JSR 168 Portlet that are Jetspeed 2 dependent

First you should create a new Project for the Portlet i.e. "FirstPortlet". Next you have to create a source folder "src/java" with a package "de.oio.portlets" for your first portlet. Additionally there is even a simple JSP integrated in this portlet. This JSP can be found in "src/webapp/jsp/firstportlet.jsp". There are two inital descriptors needed for a portlet First the web.xml as in other projects and second the portlet.xml. These files have to be created in the "src/webapp/WEB-INF" folder. After finishing these inital steps you have to create a new Java class in your created package "". The code of your first portlet could look like:


                <TITLE>Orientation in Objects GmbH</TITLE>
        <H3>Welcome !</H3>


package de.oio.portlets;


import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

 * @author bbratkus
public class FirstPortlet extends GenericPortlet{

        Writer writer;
        /* (non-Javadoc)
         * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
        protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
                        throws PortletException, IOException {
                writer = renderResponse.getWriter();
                writer.write("Hello I am a portlet and I am trapped in a Portal!");
                String jspName = "/jsp/firstportlet.jsp";
                writer.write("<IMG SRC="+renderResponse.encodeURL(renderRequest.getContextPath()+"/pics/oio.gif")+">");
                PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
                rd.include(renderRequest, renderResponse);
                writer.write("Der momentan angemeldete Benutzer : "+renderRequest.getRemoteUser());
                writer.write("Die Rolle des angemeldeten Benutzers : "+renderRequest.isUserInRole("plutoTestRole"));
        /* (non-Javadoc)
         * @see javax.portlet.GenericPortlet#doHelp(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
        protected void doHelp(RenderRequest request, RenderResponse response)
                        throws PortletException, IOException {
                writer = response.getWriter();
                response.setTitle("Helpsite of "+super.getTitle(request));
                writer.write("Hier kann man Informationen über die Benutzung des Portlets hinterlgen.");
        /* (non-Javadoc)
         * @see javax.portlet.GenericPortlet#doEdit(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
        protected void doEdit(RenderRequest request, RenderResponse response)
                        throws PortletException, IOException {
                writer = response.getWriter();
                writer.write("Hier können Eigenschaften die -modifiable- sind von den Benutzern geändert werden");
                writer.write("Man hat beispielsweise die Möglichkeit den Title zu ändern, neben der Möglichkeit in der portlet.xml ");
                writer.write("Das "+super.getTitle(request)+" war der alte Titel");
                response.setTitle("Edit of "+super.getTitle(request));


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "">


<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="" 
        version="1.0" xmlns:xsi="" 


Creating the war - web archive

After finishing the coding of the portlet and the jsp and descriptors you have to create a war archive out of it. Therefore you should use Maven or Ant. Of course you have to add some jar archives to your project for the portlets, servlets, xdoclet or even more. But if you are using Maven, these jars can be found in your maven repository. So you have to learn the work with Maven or you use Ant. In this example Maven is used. Here is another example for the maven.xml in your project root folder: maven.xml

<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
  <preGoal name="java:compile">
    <mkdir dir="${}/xdoclet/webdoclet/WEB-INF" />
        <attainGoal name="xdoclet:webdoclet" />

Even some properties have to be definded. These properties can be found in the "" file in your root folder too.

And last the "project.xml" even this file is in your project root folder.

                <name>Orientation in Objects GmbH</name>
        <description>An example project for porlet development</description>
        <shortDescription>An example project for porlet development</shortDescription>
        <!-- who the developers are for the project -->
        <!-- jar files the project is dependent on -->
                <!-- XDoclet dependencies -->

Individualisation of the appearance

While customizing the CSS of one Layout you can easyly edit the default appearance of Jetspeed2. For example you can edit the layout-decorator and the portlet-decorator of the tigris layout.

===== Example ====

<!-- jetspeed\WEB-INF\decorations\layout\html\tigris\decorator-top.vm -->
<!-- Banner -->
      <div id="banner">
        <table border="0" cellspacing="0" cellpadding="8" width="100%">
              <h1><img src="content/images/oio.gif" alt="Orientation in Objects Logo" border="0"/></h1>
              <div align="right" id="login">

And an example fragment of the CSS file.


a:hover {
    color: #f5a83d !important; /*default: #f30 - here you can edit the color of the tabs when the mouse hovers above */

Additionally there is the posibility to customize single pages via the different Jetspeed2-Layouts i.e. "VelocityOneColumn" in difference to the start page which uses the „VelocityTwoColumn“. Therefore you have to edit the following data:

the rss.psml

This is an example for a jetspeed2 portal site, which includes only one portlet. So this site should completly filled out with the portlet. Therefore you can use the "VelocityOneColumn" - Layout.


<page id="rss">
<defaults skin="orange“ layout-decorator="tigris“ portlet- decorator="tigris"/>
<title>RSS Example</title>
<fragment id="rss-1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
<!-- The Layout Portlet above-named -->
         <fragment id="rss-10" type="portlet" name="OioRss::RssPortlet">
<!-- the rss portlet -->
         <property name="row" value="0" layout="OneColumn"/>
         <property name="column" value="0" layout="OneColumn"/>     


Developing components using the Bridges

The Struts Bridge

Look at these pointers:

And take a look at the JPetstore demo application implementation (there is no real documentation for this one, but it use all of the struts-bridge features listed above):

Note: this example is by default deployed in the demo installation of Jetspeed-2, so you probably already have seen/used it :)

Jetspeed2/DevelopersDocumentation (last edited 2009-09-20 23:46:26 by localhost)