2011-01-07 6 views
1

Richfaces : 요청 범위와 조건 및 콩 렌더링

<h:form> 
    <h1> JSF do not post a "execute doAction1"</h1> 
      <a4j:commandButton action="#{sample.showPanel}" value="Show Panel" 
       reRender="MyPanelShow"></a4j:commandButton> 

      <a4j:outputPanel id="MyPanelShow" > 


       <rich:panel rendered="#{sample.showPanel}" id="panel1"> 
        <h:inputText value="#{sample.name}" id="input1"></h:inputText> 
        <a4j:commandButton value="Ejecutar" action="#{sample.doAction1}" 
         reRender="MyPanelShow" id="action1"></a4j:commandButton> 
       </rich:panel> 


      </a4j:outputPanel> 

     </h:form> 

<!-- Backing Bean--> 

    package py.com.roshka.jrey.uifrw.web; 

    import java.io.Serializable; 

    public class SampleBean implements Serializable{ 
private String name; 
private boolean showPanel = false; 

public String doAction1() { 

    name = name + " Ok"; 
    return null; 
} 

public String showPanel() { 
    showPanel = true; 
    return null; 

} 

/** 
* @return the name 
*/ 
public String getName() { 
    return name; 
} 

/** 
* @param name 
*   the name to set 
*/ 
public void setName(String name) { 
    this.name = name; 
} 

/** 
* @return the showPanel 
*/ 
public boolean isShowPanel() { 
    return showPanel; 
} 

/** 
* @param showPanel 
*   the showPanel to set 
*/ 
public void setShowPanel(boolean showPanel) { 
    this.showPanel = showPanel; 
} 

} 

답변

2

, 내 행동은 ??? showPanel가 = true로 설정 showPanel 액션 doAction1을 실행할 수 없습니다 않습니다 내 JSF는 확인

rendered="#{sample.showPanel}" 

은 제출할 때 'true'로 평가됩니다.

+0

showPanel = true .. 첫 번째 조치는 showPanel = true로 설정했지만 요청 빈은 등록 정보가있는 bean 상태를 저장하지 않습니다 ... 두 번째 작업을 제출할 때 현재 showPanel 등록 정보를 어떻게 설정할 수 있습니까 ??? , 당신은 몇 가지 예입니다 ... 어떻게 정확하게 그것입니까? 고마워. – jrey

+1

요청 범위가 지정된 bean은 하나의 요청에 대한 값을 보유합니다. 세션,보기 또는 대화와 같은 더 긴 범위를 사용해야합니다. –