You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Dahl, Sandra" <SD...@TDIinc.com> on 2009/11/02 18:07:27 UTC

richfaces portlet

I am trying to get richfaces working with Jetspeed, jsf and facelets. I started by copying an existing jsf/facelets sub-project and made the following changes. The web.xml was updated as follows:
<!-- Plugging the "Blue Sky" skin into the project -->
  <context-param>
   <param-name>org.richfaces.SKIN</param-name>
   <param-value>blueSky</param-value>
  </context-param>

  <!-- Making the RichFaces skin spread to standard HTML controls -->
  <context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
  </context-param>

   <!-- This is optional parameters for a Richfaces facelets based application -->
   <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
   </context-param>

  <filter>
   <display-name>RichFaces Filter</display-name>
   <filter-name>richfaces</filter-name>
   <filter-class>org.ajax4jsf.Filter</filter-class>
  </filter>

  <filter-mapping>
   <filter-name>richfaces</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
   <dispatcher>REQUEST</dispatcher>
   <dispatcher>FORWARD</dispatcher>
   <dispatcher>INCLUDE</dispatcher>
  </filter-mapping>

The project's pom.xml includes the richfaces repositories:
<!-- add richfaces repositories -->
   <repository>
      <releases>
          <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>true</enabled>
          <updatePolicy>always</updatePolicy>
      </snapshots>
      <id>snapshots.jboss.org</id>
      <name>Snapshot Jboss Repository for Maven</name>
      <url>http://snapshots.jboss.org/maven2/</url>
      <layout>default</layout>
   </repository>
   <repository>
      <releases>
          <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>true</enabled>
          <updatePolicy>always</updatePolicy>
      </snapshots>
      <id>repository.jboss.com</id>
      <name>Jboss Repository for Maven</name>
      <url>http://repository.jboss.com/maven2/</url>
      <layout>default</layout>
    </repository>

I added the new richfaces portlet to default-page.psml:
<fragment id="dp-2229" type="portlet" name="TdiPortal-richfacesPortlets::MyRichfacesPortlet">
       <property name="column" value="0"></property>
       <property name="row" value="4"></property>
    </fragment>

Here is the new richfaces-portlet-view.xhtml.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
<f:view>
<body>
<ui:composition>

  <h2>JSF Application with RichFaces built by Maven</h2>

      <p>Here is an example of default inputNumberSlider:</p>

        <rich:inputNumberSlider value="50" />

        <p>Here is "minimalistic" input:</p>

        <rich:inputNumberSlider value="50" showInput="false"
            enableManualInput="false" showBoundaryValues="false"
            showToolTip="false" />

        <p>Another variation of input:</p>

        <rich:inputNumberSlider value="500" width="500" maxValue="1000"
            step="50" showToolTip="false" />

</ui:composition>

</body>
</f:view>
</html>

When the default page is opened, the following error occurs:
Caused by: java.lang.ClassCastException: org.apache.pluto.container.impl.RenderResponseImpl cannot be cast to javax.servlet.ServletResponse
                at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370)
                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                ... 89 more

I'm running:
Richfaces 3.3.2.SR1
Jetspeed 2.2.0
Tomcat 6.0.20
Facelets 1.1.14
JSF 1.2

My richfaces sub-project includes the class com.sun.facelets.FaceletPortletViewHandler.java. Any ideas of what is causing the class cast exception?

Thanks!
Sandi



________________________________
Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us by return email or telephone immediately. Thank you.

RE: richfaces portlet

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
The error was caused by declaring the view handler to be FaceletViewHandler in the web.xml rather than FaceletPortletViewHandler.

Sandi
-----Original Message-----
From: Dahl, Sandra [mailto:SDahl@TDIinc.com]
Sent: Monday, November 02, 2009 10:07 AM
To: jetspeed-dev@portals.apache.org
Subject: richfaces portlet

I am trying to get richfaces working with Jetspeed, jsf and facelets. I started by copying an existing jsf/facelets sub-project and made the following changes. The web.xml was updated as follows:
<!-- Plugging the "Blue Sky" skin into the project -->
  <context-param>
   <param-name>org.richfaces.SKIN</param-name>
   <param-value>blueSky</param-value>
  </context-param>

  <!-- Making the RichFaces skin spread to standard HTML controls -->
  <context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
  </context-param>

   <!-- This is optional parameters for a Richfaces facelets based application -->
   <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
   </context-param>

  <filter>
   <display-name>RichFaces Filter</display-name>
   <filter-name>richfaces</filter-name>
   <filter-class>org.ajax4jsf.Filter</filter-class>
  </filter>

  <filter-mapping>
   <filter-name>richfaces</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
   <dispatcher>REQUEST</dispatcher>
   <dispatcher>FORWARD</dispatcher>
   <dispatcher>INCLUDE</dispatcher>
  </filter-mapping>

The project's pom.xml includes the richfaces repositories:
<!-- add richfaces repositories -->
   <repository>
      <releases>
          <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>true</enabled>
          <updatePolicy>always</updatePolicy>
      </snapshots>
      <id>snapshots.jboss.org</id>
      <name>Snapshot Jboss Repository for Maven</name>
      <url>http://snapshots.jboss.org/maven2/</url>
      <layout>default</layout>
   </repository>
   <repository>
      <releases>
          <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>true</enabled>
          <updatePolicy>always</updatePolicy>
      </snapshots>
      <id>repository.jboss.com</id>
      <name>Jboss Repository for Maven</name>
      <url>http://repository.jboss.com/maven2/</url>
      <layout>default</layout>
    </repository>

I added the new richfaces portlet to default-page.psml:
<fragment id="dp-2229" type="portlet" name="TdiPortal-richfacesPortlets::MyRichfacesPortlet">
       <property name="column" value="0"></property>
       <property name="row" value="4"></property>
    </fragment>

Here is the new richfaces-portlet-view.xhtml.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
<f:view>
<body>
<ui:composition>

  <h2>JSF Application with RichFaces built by Maven</h2>

      <p>Here is an example of default inputNumberSlider:</p>

        <rich:inputNumberSlider value="50" />

        <p>Here is "minimalistic" input:</p>

        <rich:inputNumberSlider value="50" showInput="false"
            enableManualInput="false" showBoundaryValues="false"
            showToolTip="false" />

        <p>Another variation of input:</p>

        <rich:inputNumberSlider value="500" width="500" maxValue="1000"
            step="50" showToolTip="false" />

</ui:composition>

</body>
</f:view>
</html>

When the default page is opened, the following error occurs:
Caused by: java.lang.ClassCastException: org.apache.pluto.container.impl.RenderResponseImpl cannot be cast to javax.servlet.ServletResponse
                at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370)
                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                ... 89 more

I'm running:
Richfaces 3.3.2.SR1
Jetspeed 2.2.0
Tomcat 6.0.20
Facelets 1.1.14
JSF 1.2

My richfaces sub-project includes the class com.sun.facelets.FaceletPortletViewHandler.java. Any ideas of what is causing the class cast exception?

Thanks!
Sandi



________________________________
Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us by return email or telephone immediately. Thank you.



Email secured by Check Point


Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential.  It is intended only for the exclusive use of the addressee.  If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify us by return email or telephone immediately.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org