views:

33

answers:

1

Hi all, I am mixing jsf,richfaces and spring together (faces backing beans = spring beans) and I have a jsp page with a table. For some strange reason tag

<rich:dataTable value="#{inputBean.table}" var="tableRow">

calls inputBean.getTable() method and construct output table with the same amount table rows which table(List) has -> #{inputBean.table} was replaced with an object table from inputBean.

But when I want to display a row X value by

<h:outputText value="#{tableRow.x}" />

only #{tableRow.x} is displayed on a page, not the value. I think that it could be some configuration problem that richfaces are configured right but jsf not(h:outputText is jsf tag)

Any ideas? I would really appreciate your help. Thanks in advance. Page:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<html>
 <body>
 <f:view>
 <h:form>
    <rich:dataTable value="#{inputBean.table}" var="tableRow">
  <f:facet name="caption">
   <h:outputText value="United States Capitals" />
   </f:facet>
   <f:facet name="header">
    <h:outputText value="Capitals and States Table" />
   </f:facet>
   <rich:column>
    <f:facet name="header">x</f:facet>
    <h:outputText value="#{tableRow.x}" />
    <f:facet name="footer">State Name</f:facet>
   </rich:column>
   <rich:column>
    <f:facet name="header">lx</f:facet>
    <h:outputText value="#{tableRow.lx}" />
   <f:facet name="footer">State Capital</f:facet>
   </rich:column>
           <f:facet name="footer">
    <h:outputText value="Capitals and States Table" />
          </f:facet>
  </rich:dataTable>
 </h:form>
</f:view>
</body>
</html>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
 <!--  *********** Faces config *********** -->
 <context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>server</param-value>
 </context-param>
 <context-param>
  <param-name>javax.faces.CONFIG_FILES</param-name>
  <param-value>/WEB-INF/faces-config.xml</param-value>
 </context-param>
 <!-- Faces Servlet -->
 <servlet>
  <servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <!-- Faces Servlet Mapping -->
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.jsf</url-pattern>
 </servlet-mapping>
 <!--  *********** Faces config *********** -->
 <!--  *********** rich faces config *********** -->
 <!-- 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>
 <!-- Defining and mapping the RichFaces filter -->
 <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>
 <!--  *********** rich faces config *********** -->
 <!--  *********** Spring config *********** -->
 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <listener>
  <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
 </listener>
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/applicationContext.xml</param-value>
 </context-param>
 <!--  *********** Spring config *********** -->
 <welcome-file-list>
  <welcome-file>
      index.jsp
    </welcome-file>
 </welcome-file-list>
</web-app>

application config:

 <?xml version="1.0"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;
  <!-- the parent application context definition for the springapp application -->
    <bean id="inputBean" class="backingbeans.InputBean"  scope="request">
         <property name="tableService" ref="tableService"/>
    </bean>    
    <bean id="tableService" class="TableServiceImpl"  scope="session">        
    </bean>
  </beans>
A: 

Ok, after one day spent by configuring I found the error - I was using richfaces 3.1.0 but jsf 1.2 !!! After I migrated to jsf 2.x problems disappeared suddenly. I think that main problem was that new richfaces can not be mixed with old jsf.

Stepik