Problems after migrating to JSF 2.0 and RichFaces 4.1.0Final
srd.pl Feb 28, 2012 10:12 AMI have updated my project to richfaces 4.1.0 and JSF 2.0. I have abviously changed the maven dependencies, updated web.xml, faces-config.xml, swtiched from *.jsp files to *.xhtml files, updated all head,body,form to h:head, h:body, h:form. However, I have significant problems with my page layout and a4j:ajax behavior. I think that it's best if I just list the problems:
- My rich:datatable skin stopped working. I even tried deleting the columnClass etc. attributes from the tag to leave it with default bluesky skin, but the outcome looks just like a plain html table (no lines, no background, no colors).
- the a4j:axjax tag works much worse thatn a4j:support did. For my selectOneMenus I tried event="change" but it doesn't work. Only after adding a valueChangedListener to the tags and tried event="valueChange" it worked.
- rich:calendar elements are not 'clickable' - when I move the coursor over the button to popup the calendar it's not changing and when I click on the button nothing happens. I also need the a4j:ajax here but am not able to test it.
- Although event="valueChange" worked on selectOneMenu, my a4j:mediaOutput image is not re-rendered. And the chart was the reason why I switched to JSF 2.0 because I needed to use the session-data-helper mechanism to load the images. Is there a special mechanism to rerender (or now 'render' with a4j:ajax) this element when it's using the session-data-helper for loading data?
Here are the web.xml and index.xhtml files:
<?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/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>presentation graph</display-name>
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/data-helper.taglib.xml</param-value>
</context-param>
<context-param>
<param-name>javac.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
</web-app>
index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:sdh="http://richfaces.org/session-data-helper">
<h:head>
<title>Graph presentation</title>
<h:outputStylesheet name="style.css" library="css" />
</h:head>
<h:body>
<h:form id="form">
<div class="grid_2">
<rich:calendar value="#{formBean.date}"
id="date" popup="true" datePattern="yyyy/MM/dd"
showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px">
<a4j:ajax event="change" render="resultTable chart" execute="@this" listener="#{formBean.dateSelected}"/>
</rich:calendar>
</div>
<div class="grid_2">
<h:selectOneMenu id="selectMenu" value="#{formBean.model.selected_id}" valueChangeListener="#{formBean.selected}" styleClass="comboBoxes">
<f:selectItems value="#{formBean.myModelValues}" />
<a4j:ajax execute="@this" event="valueChange" render="resultTable chart" ajaxSingle="true"/>
</h:selectOneMenu>
</div>
<div id="list" class="container2">
<rich:dataTable id="resultTable" value="#{formBean.results}" var="query" rows="10" headerClass="columnclass" rowClasses="rowclass" styleClass="datatable" cellpadding="1" cellspacing="1" rules="rows" >
<rich:column headerClass="columnclass" width="100" >
<f:facet name="header">
<h:outputText value="Values" style="align:center; text-align:center; " />
</f:facet>
<h:outputText value="#{query.val}" />
</rich:column>
<rich:column headerClass="columnclass" width="100" >
<f:facet name="header">
<h:outputText value="Models" style="align:center; text-align:center; " />
</f:facet>
<h:outputText value="#{query.model}" />
</rich:column>
<f:facet name="footer">
<rich:dataScroller page="#{formBean.page}" style="margin-left: 15%; margin-right: 15%; width: 70%;">
<f:facet name="first">
<h:outputText value="First" />
</f:facet>
<f:facet name="last">
<h:outputText value="Last" />
</f:facet>
</rich:dataScroller>
</f:facet>
</rich:dataTable>
</div>
<div id="graph" class="container2">
<a4j:mediaOutput
id="chart"
element="img"
cacheable="false"
session="true"
createContent="#{mediaPainter.drawChartImage}"
value = "#{sdh:storeData(formBean.chartData)}"
mimeType="image/jpeg"
/>
</div>
</h:form>
</h:body>
</html>
here is a list of .jar files deployed with the webapp:
commons-logging-1.1.1.jar
cssparser-0.9.5.jar
guava-r08.jar
jcommon-1.0.16.jar
jfreechart-1.0.13.jar
jsf-api-2.1.6.jar
jsf-impl-2.1.6.jar
jstl-1.2.jar mysql-connector-java-5.1.18.jar oscache-2.3.jar richfaces-components-api-4.1.0.Final.jar richfaces-components-ui-4.1.0.Final.jar richfaces-core-api-4.1.0.Final.jar richfaces-core-impl-4.1.0.Final.jar sac-1.3.jar