Forums de discussion

Apache Trinidad Chart

thumbnail
Chris Jurado, modifié il y a 12 années.

Apache Trinidad Chart

Junior Member Publications: 66 Date d'inscription: 16/07/10 Publications récentes
Hey all,

Hello,

I’m working on a portlet using MyFaces and Trinidad. I have successfully created a working hello world portlet using:

Apache MyFaces 2.0
Apache PortletBridge 3.0
Apache Trinidad 2.0

The environment is

Liferay 6.0.6 running on Tomcat 6.0.29

The portlet installs and runs fine, displaying a simple outputText control, but the Trinidad Chart control doesn’t display. The value is set to a backing bean that is being instantiated (debug statement in the constructor outputs) but no graphical display.

My faces-config.xml:

<!--?xml version="1.0" encoding="UTF-8"?-->
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2">

      <managed-bean>
            <managed-bean-name>chartBacking</managed-bean-name>
            <managed-bean-class>com.jhu.cvrg.portal.dashboard.backing.ChartBacking</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>

      <application>
            <default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
      </application>
</faces-config>


My Trinidad-config.xml

<!--?xml version="1.0"?-->
<trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
  <!-- Enable debug output -->
  <debug-output>true</debug-output>
</trinidad-config>


My view.xhtml:

<f:view xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:trh="http://myfaces.apache.org/trinidad/html">
      <trh:head />
      <trh:body>
                  <h:outputtext value="BOOYAH!" />
                  <tr:chart id="chart" rendered="true" value="#{chartBacking.chartModel}" type="line" />
      </trh:body>
</f:view>

My web.xml:

<!--?xml version="1.0" encoding="UTF-8"?-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <servlet>
            <servlet-name>faces</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
            <servlet-name>faces</servlet-name>
            <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>

      <servlet>
            <servlet-name>resources</servlet-name>
            <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
      </servlet>

      <!-- This cannot be configured currently -->
      <servlet-mapping>
            <servlet-name>resources</servlet-name>
            <url-pattern>/adf/*</url-pattern>
      </servlet-mapping>

      <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
      </context-param>
      <context-param>
            <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
            <!-- TrinidadFaceletViewHander must be the alternate view handler if SessionChangeManager 
                  is used -->
            <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
      </context-param>

      <context-param>
            <!--Unfortunately, Facelets provides no hook for plugging the PageResolver 
                  into the logic handling "facelets.VIEW_MAPPINGS". You should leave "facelets.VIEW_MAPPINGS" 
                  unset and use "org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS" instead. -->
            <param-name>org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS</param-name>
            <param-value>*.xhtml</param-value>
      </context-param>
      
      <!--  More Trinidad Configuration -->
      <context-param>
            <param-name>org.apache.myfaces.trinidad.security.FRAME_BUSTING</param-name>
            <param-value>never</param-value>
      </context-param>
      
      <context-param>
            <param-name>org.apache.myfaces.trinidad.util.ExternalContextUtils.isPortlet</param-name>
            <param-value>true</param-value>
      </context-param>  
      
      <filter>
            <filter-name>trinidad</filter-name>
            <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
      </filter>

      <filter-mapping>
            <filter-name>trinidad</filter-name>
            <!-- This assumes that the FacesServlet has been registered -->
            <!-- under the name "faces" -->
            <servlet-name>faces</servlet-name>
      </filter-mapping>

      <listener>
            <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
</web-app>


I’m getting no errors of any kind, yet all I see in the portlet view is the value of the h:outputText, and the debug statement in my backing bean outputs, so at least I know everything else is working. I installed it as a stand alone app in a separate Tomcat and it worked great. I suspect it's a conflict with either the JavaScript in the component or maybe the images.

Any ideas? I can't be the only one to have faced this.
David Parry, modifié il y a 10 années.

RE: Apache Trinidad Chart

New Member Envoyer: 1 Date d'inscription: 03/09/13 Publications récentes
I do not see this entry in web.xml


 <managed-bean>
        <managed-bean-name>chartBean</managed-bean-name>
        <managed-bean-class>org.apache.myfaces.trinidaddemo.components.output.chart.ChartBean
        </managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>