繁体   English   中英

JSF不解释占位符<h:outputText value=“#{tableRow.x}” />

[英]JSF do not interpret placeholder in <h:outputText value=“#{tableRow.x}” />

我将jsf,richfaces和spring混合在一起(faces backing beans = spring beans),并且我有一个带有表的jsp页面。 由于一些奇怪的原因标签

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

调用inputBean.getTable()方法,并使用表(列表)具有的相同数量的表行构造输出表->#{inputBean.table}被inputBean中的对象表替换。

但是当我想通过显示行X值时

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

页面上仅显示#{tableRow.x} ,而不显示该值。 我认为Richfaces配置正确但jsf没有配置可能是一些配置问题(h:outputText是jsf标签)

有任何想法吗? 我将衷心感谢您的帮助。 提前致谢。 页:

<!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">
 <!--  *********** 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>

应用程序配置:

 <?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">
  <!-- 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>

好的,经过花了一天的配置,我发现了错误-我使用的是richfaces 3.1.0,但使用jsf 1.2! 当我迁移到jsf 2.x之后,问题突然消失了。 我认为主要问题是新的richfaces无法与旧的jsf混合使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM