1 Reply Latest reply on Oct 10, 2008 12:02 PM by Viggo Navarsete

    Display swf within portlet

    Anant Jagania Newbie

      All,

      I have a sample portlet which should display a swf file. The portlet deploys without any problems but when viewed does not display the swf.

      Here is my code

      HelloWorldPortlet.java
      public class HelloWorldPortlet extends GenericPortlet
      {
       protected void doView(RenderRequest rRequest, RenderResponse rResponse)
       throws PortletException, IOException, UnavailableException
       {
       try
       {
       rResponse.setContentType("text/html");
       javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/FirstChart.html");
       prd.include(rRequest, rResponse);
       }
       catch(Exception e)
       {
       e.printStackTrace();
       }
       }
      }
      


      helloworld-object.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE deployments PUBLIC
       "-//JBoss Portal//DTD Portal Object 2.6//EN"
       "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
      <deployments>
       <deployment>
       <parent-ref>default.default</parent-ref>
       <if-exists>overwrite</if-exists>
       <window>
       <window-name>HelloWorldPortletWindow</window-name>
       <instance-ref>HelloWorldPortletInstance</instance-ref>
       <region>center</region>
       <height>1</height>
       </window>
       </deployment>
      </deployments>
      


      jboss-portlet.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE portlet-app PUBLIC
       "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
       "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
      <portlet-app>
       <portlet>
       <portlet-name>HelloWorldPortlet</portlet-name>
       <header-content>
       <script type="text/javascript" src="/js/FusionCharts.js"></script>
       </header-content>
       </portlet>
      </portlet-app>
      


      <?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>
       <portlet-name>HelloWorldPortlet</portlet-name>
       <portlet-class>HelloWorldPortlet</portlet-class>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
       <title>HelloWorld Portlet</title>
       </portlet-info>
       </portlet>
      </portlet-app>
      


      portlet-instance.xml
      <?xml version="1.0" standalone="yes"?>
      <!DOCTYPE deployments PUBLIC
       "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
       "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
      <deployments>
       <deployment>
       <instance>
       <instance-id>HelloWorldPortletInstance</instance-id>
       <portlet-ref>HelloWorldPortlet</portlet-ref>
       </instance>
       </deployment>
      </deployments>
      


      FirstChart.html
      <body>
       <div id="chartdiv" align="center">
       The chart will appear within this DIV. This text will be replaced by the chart.
       </div>
      </body>
      


      Any help would be appreciated.

      Thanks
      Anant J