2012-10-18 61 views
0

我想我有一個richFaces的bug。rich:tabPanel不能和textarea一起工作

我有一個帶有switchType ='ajax'和2(空)選項卡的tabPanel的簡單頁面,第一個選項卡只包含一個textarea,其值綁定到一個bean屬性,tabPanel不起作用。嘗試更改標籤時出現以下日誌消息:

info [11:31:56.919]: Received 'begin' event from <div id=form:j_id2114509110_7e08d99f ...> 
info [11:31:56.953]: Received 'beforedomupdate' event from <div id=form:j_id2114509110_7e08d99f ...> 
info [11:31:56.957]: Element error 
<error><error-name>javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[org.apache.myfaces.view.facelets.el.ContextAwarePropertyNotWritableException: javax.el.PropertyNotWritableException: ResourceBundles are read-only]]></error-message></error> 
error[11:31:56.959]: Received '[email protected]' event from <div id=form:j_id2114509110_7e08d99f ...> 
error[11:31:56.961]: [200] undefined: undefined 
info [11:31:56.962]: Received 'complete' event from <div id=form:j_id2114509110_7e08d99f 

當我刪除值綁定時,一切都按預期工作。 另外通過輸入框更改textarea工作正常

更新:我還得到了一個服務器錯誤與switchType = '服務器':

javax.el.PropertyNotWritableException: ResourceBundles are read-only 
    org.apache.myfaces.el.unified.resolver.ResourceBundleResolver.setValue(ResourceBundleResolver.java:69) 
    javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68) 
    org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:229) 
    org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73) 
    org.jboss.el.parser.AstValue.setValue(AstValue.java:84) 
    org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249) 
    org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.setValue(ContextAwareTagValueExpression.java:151) 
    javax.faces.component.UIInput.updateModel(UIInput.java:402) 
    javax.faces.component.UIInput.processUpdates(UIInput.java:324) 
    javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1332) 
    org.richfaces.component.AbstractTogglePanel.processUpdates(AbstractTogglePanel.java:302) 
    javax.faces.component.UIForm.processUpdates(UIForm.java:217) 
    javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1332) 
    javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1332) 
    javax.faces.component.UIViewRoot._processUpdatesDefault(UIViewRoot.java:1311) 
    javax.faces.component.UIViewRoot.access$600(UIViewRoot.java:74) 
    javax.faces.component.UIViewRoot$UpdateModelPhaseProcessor.process(UIViewRoot.java:1413) 
    javax.faces.component.UIViewRoot._process(UIViewRoot.java:1272) 
    javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:782) 
    org.apache.myfaces.lifecycle.UpdateModelValuesExecutor.execute(UpdateModelValuesExecutor.java:38) 
    org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171) 
    org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) 
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) 
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
    org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:392) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359) 
    org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) 
    org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
    org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174) 
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) 
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) 
    org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) 
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 

這裏是工作代碼:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<!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:h="http://java.sun.com/jsf/html" 
     xmlns:a4j="http://richfaces.org/a4j" 
     xmlns:rich="http://richfaces.org/rich" > 

    <h:head><title>Test</title></h:head> 
    <h:body> 
    <h:form id="form" > 
     <h1>Test</h1> 
     <rich:tabPanel switchType="ajax" > 
     <rich:tab name="tab1" header="tab1"> 
      <h:inputTextarea value="#{testBean.text}" /> 
     </rich:tab> 
     <rich:tab name="tab2" header="tab2"> 
      Tab2 
     </rich:tab> 
     </rich:tabPanel> 
    </h:form> 
    <a4j:log style="text-align:left;height:auto;" /> 
    </h:body>  
</html> 

,在這裏我的環境: 的Tomcat 6.0.18, Java 1.6.0_25,Win6.1 build 7601

和相關性:

<dependency> 
    <groupId>org.apache.myfaces.tomahawk</groupId> 
    <artifactId>tomahawk20</artifactId> 
    <version>1.1.10</version> 
</dependency> 
<dependency> 
    <groupId>taglibs</groupId> 
    <artifactId>standard</artifactId> 
    <version>1.1.2</version> 
</dependency> 
<dependency> 
    <artifactId>myfaces-impl</artifactId> 
    <groupId>org.apache.myfaces.core</groupId> 
    <version>2.0.9</version> 
</dependency> 
<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.1.0</version> 
</dependency> 
<dependency> 
    <groupId>org.richfaces.core</groupId> 
    <artifactId>richfaces-core-impl</artifactId> 
    <version>4.2.2.Final</version> 
</dependency> 
<dependency> 
    <groupId>org.richfaces.ui</groupId> 
    <artifactId>richfaces-components-ui</artifactId> 
    <version>4.2.2.Final</version> 
</dependency> 
<dependency> 
    <groupId>org.jboss.seam</groupId> 
    <artifactId>jboss-el</artifactId> 
    <version>2.0.0.GA</version> 
    <scope>runtime</scope> 
    <exclusions> 
    <exclusion> 
     <artifactId>javax.el</artifactId> 
     <groupId>el-api</groupId> 
    </exclusion> 
    </exclusions> 
</dependency>   

有人遇到過這樣的問題,有沒有什麼解決辦法?

回答

0

所以,我明白了!

這是一種錯誤,但在org.apache.myfaces.el.unified.resolver.ResourceBundleResolver版本2.0.9。

問題是我的屬性被命名爲「文本」,我也有一個名爲「文本」的資源包。此外在javax.el.CompositeELResolverorg.apache.myfaces.el.unified.resolver.ResourceBundleResolver之前是javax.el.BeanELResolver

org.apache.myfaces.el.unified.resolver.ResourceBundleResolver.setValue(ELContext context, Object base, Object property, Object value)方法不檢查基礎對象,只是尋找一個名爲屬性的資源包,在我的情況下它找到了一些東西和彭!例外!

它應該檢查(base != null),然後離開。