2013-03-28 2 views
1

내 JSF 페이지에 commandButton 구성 요소가 버튼을 누르십시오. 나는 그것을 클릭하면 이상하게 commandButton 동작합니다 반면 원하는대로 의 dataTable는 같은 디스플레이의 결과로 업데이트됩니다PrimeFaces는

button after update

누군가가 나에게 이런 이상한 상황의 원인을 이해하고 또한 솔루션을 파악하는 데 도움이 될 수 있습니다 가능하다면?

참고 :

  • JSF 구현 및 버전 : 인 Mojarra (javax.faces-2.1.11.jar)
  • 보기 기술 : Facelets의 (XHTML)
  • 복사 'n'paste'n'runnable 예제! (SSCCE)는 다음과 같습니다 :

FilterBean.java을 :

package com.turkcell.mdealer.bean.impl; 

import org.springframework.stereotype.Component; 

@Component 
public class FilterBean { 
    private boolean monthly = true; 

    public String applyPeriod(String caller) { 
     monthly = !monthly; 
     return caller; 
    } 

    public boolean isMonthly() { 
     return monthly; 
    } 

    public void setMonthly(boolean monthly) { 
     this.monthly = monthly; 
    } 
} 

sample.xhtml : 라이브러리의

<f:view xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:c="http://java.sun.com/jsp/jstl/core" 
    xmlns:turkcell="http://turkcell.com/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui" 
    xmlns:of="http://omnifaces.org/functions" 
    xmlns:pm="http://primefaces.org/mobile" contentType="text/html" 
    renderKitId="PRIMEFACES_MOBILE"> 
    <pm:page title="Bayi Raporlari"> 
     <pm:view id="FaturasizAktivasyon" swatch="c"> 
      <p:outputPanel id="FaturasizPanel"> 
       <h:form id="FaturasizForm"> 
        <pm:content> 
         <p:commandButton id="period" 
          value="#{filterBean.monthly == false ? 'Yearly' : 'Monthly'}" 
          action="#{filterBean.applyPeriod('sample')}" update="period"> 
         </p:commandButton> 
        </pm:content> 
       </h:form> 
      </p:outputPanel> 
     </pm:view> 
    </pm:page> 
</f:view> 

일반보기 :

enter image description here

+1

당신의 PF 3.5 및 Mojarra 2.1.14의 문제점 어떤 버전의 Primeface와 JSF를 사용하고 있습니까? – partlov

+0

@partlov _primefaces-3.5.jar_ 및 _javax.faces-2.1.11.jar_ – Juvanis

+0

을 사용하고 있습니다. Mojarra 버전을 업데이트하고 문제가 사라질 수 있습니까? 그렇지 않은 경우 페이지의 다른 부분의 부작용 일 가능성이 큽니다. 이 경우 전체 페이지 소스를 게시하십시오. – partlov

답변

1

나는 당신이 사용할 수있는,

그러나 이상한 행동의 이유를 모르는 이 조건부 버튼이 같은 효과를 달성하기 위해 렌더링 : 나는 재생할 수없는

<p:panelGroup> 
    <p:commandButton value="Monthly" 
     action="#{myBean.doSomeOtherStuff()}" 
     update="myDataTable @parent" rendered="#{myBean.isMonthly}" /> 
    <p:commandButton value="Yearly" 
     action="#{myBean.doSomeOtherStuff()}" 
     update="myDataTable @parent" rendered="#{not myBean.isMonthly}" /> 
</p:panelGroup> 
+0

고맙습니다. 친애하는 Kerem. 누군가가 중첩 된 버튼의 이유를 발견 할 때까지 허용되는 대답입니다. – Juvanis

+0

당신은 환영합니다 –

관련 문제