1 Reply Latest reply on Aug 29, 2007 2:29 AM by habicht

    How to deploy 2 portlets in the same WAR

    jado

      I am new to portals and i am trying to deploy 2 portlets in the same war in jboss.

      I defined both portlets in portal.xml and portlet-instances.xml but only 1 of my portlet instance is registered with jboss portal on startup

      My portal.xml and portal-instance.xml are

      <?xml version="1.0" encoding="UTF-8"?>
      <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 http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
      version="1.0">

      <portlet-name>SecondPortlet</portlet-name>
      <portlet-class>org.jboss.portlet.SecondPortlet</portlet-class>

      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>

      <portlet-info>
      SecondPortlet
      </portlet-info>



      <portlet-name>FirstPortlet</portlet-name>
      <portlet-class>org.jboss.FirstPortlet</portlet-class>

      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>

      <portlet-info>
      First Portlet
      </portlet-info>

      </portlet-app>

      <?xml version="1.0" standalone="yes"?>



      <instance-id>FirstInstance</instance-id>
      <portlet-ref>FirstPortlet</portlet-ref>


      <instance-id>SecondInstance</instance-id>
      <portlet-ref>SecondPortlet</portlet-ref>




      can somebody help me please

        • 1. Re: How to deploy 2 portlets in the same WAR
          habicht

          i guess you mean the file portlet.xml. here is an example that i use

          <?xml version="1.0" encoding="UTF-8"?>
          <portlet-app id="PortletA" version="1.0">
           <portlet id="PortletA">
           <portlet-name>portleta</portlet-name>
           <display-name>portleta</display-name>
           <portlet-class>test.PortletA</portlet-class>
           <expiration-cache>0</expiration-cache>
           <supports>
           <mime-type>text/html</mime-type>
           <portlet-mode>VIEW</portlet-mode>
           </supports>
           <portlet-info>
           <short-title>Portlet A</short-title>
           <keywords>Portlet</keywords>
           </portlet-info>
           </portlet>
          </portlet-app>


          so the file for 2 portlets should look something like that
          <?xml version="1.0" encoding="UTF-8"?>
          <portlet-app id="Portlets" version="1.0">
           <portlet id="PortletA">
           <portlet-name>portleta</portlet-name>
           <display-name>portleta</display-name>
           <portlet-class>test.PortletA</portlet-class>
           <expiration-cache>0</expiration-cache>
           <supports>
           <mime-type>text/html</mime-type>
           <portlet-mode>VIEW</portlet-mode>
           </supports>
           <portlet-info>
           <short-title>Portlet A</short-title>
           <keywords>Portlet</keywords>
           </portlet-info>
           </portlet>
           <portlet id="PortletB">
           <portlet-name>portletb</portlet-name>
           <display-name>portletb</display-name>
           <portlet-class>test.PortletB</portlet-class>
           <expiration-cache>0</expiration-cache>
           <supports>
           <mime-type>text/html</mime-type>
           <portlet-mode>VIEW</portlet-mode>
           </supports>
           <portlet-info>
           <short-title>Portlet B</short-title>
           <keywords>Portlet</keywords>
           </portlet-info>
           </portlet>
          </portlet-app>


          as for the portlet-instances.xml i'm not sure what the file should look like.

          hope this can help you

          greetings habicht