Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added section about portlet-class

portlet-class

To use the Struts 2 Portlet framework, use org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher as the portlet class in your portlet.xml file:

Code Block
titleportlet.xml

<portlet-app
    version="1.0"
    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    id="my-portlet-app">

    <portlet id="MyPortlet">
        <description xml:lang="EN">My Portlet</description>
        <portlet-name>MyPortlet</portlet-name>
        <display-name xml:lang="EN">my-portlet</display-name>
    
        <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
        
        <!-- SNIP -->

    </portlet>
</portlet-app>
Note
The Portlet support is experimental. Feedback is appreciated!

Portlet Init Parameters

Below is the init-param elements that you can set up in portlet.xml for configuring the portlet mode -> xwork namespace mappings for the portlet. Basically, you can think of the different portlet modes as different sub-applications, so it can be useful to set up the struts.xml configuration with different namespaces for the different portlets and modes:

...