1 Reply Latest reply on Sep 9, 2005 11:20 AM by Benjamin Rupp

    Help wanted: How do I deploy multiple portlets in a war file

    Kent C Newbie

      Hi,

      How do I deploy multiple portlets in a war? Currently I have a .war file (referenced in jboss-app.xml) with 2 portlets defined. The portlets are registered and show up in the menu but display blank page when clicked on the portlet links.

      If I have only one portlet in the .war everything works fine but when I put 2 together I get a blank page. Currently my jboss-app.xml looks as shown below,

      <jboss-app>
      <app-name>myPortlets</app-name>
      </jboss-app>

      where myPortlets is name of the war file.

      Thanx

        • 1. Re: Help wanted: How do I deploy multiple portlets in a war
          Benjamin Rupp Newbie

          jboss-app.xml

          <jboss-app>
           <app-name>helloworld</app-name>
          </jboss-app>
          



          jboss-portlet.xml

          <portlet-app>
           <portlet>
           <portlet-name>HelloWorldPortlet</portlet-name>
           <security></security>
           </portlet>
           <portlet>
           <portlet-name>HelloWorldPortlet2</portlet-name>
           <security></security>
           </portlet>
          </portlet-app>
          



          portlet.xml

          <portlet-app 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 /opt/SUNWps/dtd/portlet.xsd"
           version="1.0">
          
           <portlet>
           <portlet-name>HelloWorldPortlet</portlet-name>
           <portlet-class>org.jboss.portlet.helloworld.HelloWorld</portlet-class>
           <supported-locale>en</supported-locale>
           <!-- <resource-bundle>Resource</resource-bundle> -->
           <supports>
           <mime-type>text/html</mime-type>
           <portlet-mode>VIEW</portlet-mode>
           </supports>
           <portlet-info>
           <title>My First HelloWorld Portlet</title>
           </portlet-info>
           <portlet-preferences>
           <preference>
           <name>displayedPage</name>
           <value>/index.jsp</value>
           </preference>
          
           <preference>
           <name>showTitle</name>
           <value>First Portlet</value>
           </preference>
          
           </portlet-preferences>
           </portlet>
           <portlet>
           <portlet-name>HelloWorldPortlet2</portlet-name>
           <portlet-class>org.jboss.portlet.helloworld.HelloWorld</portlet-class>
           <supported-locale>en</supported-locale>
           <!-- <resource-bundle>Resource</resource-bundle> -->
           <supports>
           <mime-type>text/html</mime-type>
           <portlet-mode>VIEW</portlet-mode>
           </supports>
           <portlet-info>
           <title>My Second HelloWorld Portlet</title>
           </portlet-info>
           <portlet-preferences>
           <preference>
           <name>displayedPage</name>
           <value>/index.jsp</value>
           </preference>
          
           <preference>
           <name>showTitle</name>
           <value>Second Portlet</value>
           </preference>
          
           </portlet-preferences>
           </portlet>
          </portlet-app>
          


          portlet-instances.xml

          <instances>
           <instance>
           <instance-name>HelloWorldPortletInstance</instance-name>
           <component-ref>HelloWorldPortlet</component-ref>
           </instance>
           <instance>
           <instance-name>HelloWorldPortletInstance2</instance-name>
           <component-ref>HelloWorldPortlet2</component-ref>
           </instance>
          </instances>
          


          *-pages.xml


          <pages>
           <portal-name>default</portal-name>
           <page>
           <page-name>helloworld</page-name>
           <window>
           <window-name>HelloWorldPortletWindow</window-name>
           <instance-ref>helloworld.HelloWorldPortlet.HelloWorldPortletInstance</instance-ref>
           <default>true</default>
           <region>left</region>
           <height>2</height>
           </window>
           <window>
           <window-name>HelloWorldPortletWindow2</window-name>
           <instance-ref>helloworld.HelloWorldPortlet2.HelloWorldPortletInstance2</instance-ref>
           <region>left</region>
           <height>1</height>
           </window>
           </page>
          
          
          </pages>
          



          That worked for me as a small test. I took the same class-File both portlets. The first part of the <instance-ref> in *-pages-xml has to be the jboss-app name so it is the same for both portlets.