Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3



The Portlet Plugin


is used for developing JSR168 JSR286 portlets using Struts 2



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

Code Block

    <?xml version="1.0" encoding="UTF-8"?>

<portlet-app id="my-portlet-app"
    	xmlns:xsi=""     version="2.0"

    <portlet id="MyPortlet">
        <description xml:lang="EN">My Portlet</description>
        <display-name xml:lang="EN">my-portlet</display-name>
        <!-- SNIP -->



Code Block

    <!-- Portlet namespace -->
    <!-- The base namespace of the view portlet mode -->
    <!-- The default action to invoke in view mode -->


If you want to access to expose the OGNL value stack through request attributes (e.g. if you want to use regular JSTL tags to access values in the stack), you have to configure the dispatcher servlet in your web application descriptor:

Code Block

<servlet id="Struts2PortletDispatcherServlet">


Code Block

<result type="redirectAction" name="success">
    <param name="actionName">displayCart</param>
    <param name="userId">${userId}</param>  
    <!-- If you want to redirect to a different portlet mode, use the portletMode parameter 
    <param name="portletMode">view</param>


Typical usage for the portletUrlType is if you have a delete link that removes something from a database. To ensure this is done in the event phase, as recommended by the portlet specification (since it is a change of state), the url can use this attribute, e.g. <s:url action="deleteEntry" portletUrlType="action"/>


Basically the Struts2 Portlet Plugin doesn't support different auth level in the same portlet. If you want to achieve that you must create two separated portlets and configure access level with portlet engine for each of them.

Other resources

Struts 2 Portlet Tutorial
JSR168 Specification
JSR286 Specification