Show TOC

Background documentationPackaging and Deployment Descriptor Locate this document in the navigation structure

 

A portlet application is an extended Web application containing additional content such as the portlet deployment descriptor, portlet.xml, portlet classes, resources, and so on. Portlets, servlets, and JSPs are bundled together in one Web application archive (WAR). In addition to the portlet deployment descriptor, you need to specify the following portlet application properties in the Web application deployment descriptor, web.xml:

  • Description using the <description> tag

  • Name using the <display-name> tag

  • Security role mapping using the <security-role> tag

Similarly to servlet classes, portlet classes are packaged in the /WEB-INF/classes folder. Portlet classes packaged to a JAR file can also be packaged in the /WEB-INF/lib folder of the portlet application.

Example Example

A listing of a typical portlet application archive may contain the following files and folders:

/META-INF/MANIFEST.MF

/WEB-INF/web.xml

/WEB-INF/portlet.xml/WEB-INF/lib/HelperClasses.jar

/WEB-INF/classes/com/mycorp/servlets/ServletClass.class

/WEB-INF/classes/com/mycorp/portlets/PortletClass.class

/WEB-INF/classes/com/mycorp/portletresources/localization_en.properties

/WEB-INF/classes/com/mycorp/portletresources/localization_fr.properties

/WEB-INF/jsp/index.jsp

End of the example.

There are two types of mandatory information in the portlet deployment descriptor:

  • Portlet Application Definition

    The values of the following tags must be unique within the scope of the Portlet Application Definition:

    • portlet <portlet-name>

    • custom-portlet-mode <portlet-mode>

    • custom-window-state <window-state>

    • user-attribute <name>

  • Portlet Definition

    The values of the following tags must be unique within the scope of the Portlet Definition:

    • init-param <name>

    • supports <mime-type>

    • preference <name>

    • security-role-ref <role-name>