2014-12-30 2 views
0

selectonemenu의 특정 값을 선택한 경우 ajax를 사용하여 입력 텍스트를 활성화합니다. 이처럼 : 내 양식을 제출하면h : AJAX 이벤트 후 inputText 값은 항상 null입니다.

public void direcionarEnableOutros() { 
    if (this.idProduto.equals(ID_PRODUTO_OUTROS)) { 
     this.enableOutros = false; 
     this.descricaoProduto = new String(); 
    } else { 
     this.enableOutros = true; 
    } 
} 

, 입력 텍스트의 값은 항상 널 :

<a4j:outputPanel id="panelFilial"> 
    <h:selectOneMenu id="perfil" tabindex="5" 
        value="#{actionCadastrarCotacaoDadosCarga.idProduto}" 
        label="#{msg.selecione}" style="width: 145px;" 
        required="false"> 
     <f:selectItems value="#{actionCadastrarCotacaoDadosCarga.listProdutos}"></f:selectItems> 

     <a4j:support ajaxSingle="true" event="onchange" 
        action="#{actionCadastrarCotacaoDadosCarga.direcionarEnableOutros}" 
        onclick="javascript:Richfaces.showModalPanel('progressWaitModalPanel'); 
          atualizarImagem();" 
        reRender="panelOutros" /> 
    </h:selectOneMenu> 
</a4j:outputPanel> 

여기에 내 백업 콩 방법입니다. 내가 여기서 뭔가를 놓치고 있니?

가 여기에 텍스트를 입력 : 당신은 솔기를 사용하는 가정

<a4j:outputPanel id="panelOutros"> 
    <h:inputText id="outros" tabindex="6" required="false" 
       maxlength="50" 
       value="#{actionCadastrarCotacaoDadosCarga.descricaoProduto}" 
       disabled="#{!actionCadastrarCotacaoDadosCarga.habilitarCampoOutros}"> 
    </h:inputText> 
</a4j:outputPanel> 
+0

빈의 범위는 무엇입니까? –

+0

@SalihErikci 이벤트 범위가 –

+0

입니다. Whick JSF 버전을 사용하고 있습니까? –

답변

0

, 문제는 이벤트 범위에 있어야합니다. 대화 범위로 변경하십시오.

이벤트 범위

The event (request) context. Spans a server request, from restore view to render response.

회화 범위는 사용자가 동일한 뷰와 상호 작용하면서 @ViewScoped의 사용이 살아 여러분의 빈을 makee 할 수 JSF 2.x에서에서

The conversation context. Spans multiple requests from the same browser window, demarcated by @Begin and @End methods. A conversation context is propagated by any faces request, or by any request that specifies a conversation id as a request parameter. The conversation context is not available during the restore view phase.

+0

범위를 변경하면 JSF1054 : (단계 ID : PROCESS_VALIDATIONS 3, 뷰 ID : /pages/negociacao/cotacao/CadastrarCotacaoDadosGerais.xhtml) 단계 실행 중에 예외가 발생했습니다. event.PhaseEvent [source = [email protected]] –

0

예 아약스 요청. JSF 1.x에는 @ViewScoped이 없으므로 뷰 상태 또는 세션 범위에서 수동으로 데이터를 저장하고 제거해야했습니다. 당신이 RichFaces을 사용하고 있기 때문에 그럼에도 불구하고, 당신은 JSF에서 @ViewScoped 매우 유사 작동 @KeepAlive 주석을 사용할 수있다 2.

그냥이 수행

@KeepAlive 
public class ActionCadastrarCotacaoDadosCarga { 
    //bean definition here... 
} 

을 그리고 구성되어 있는지 콩을 요청 범위 :

<managed-bean-name>actionCadastrarCotacaoDadosCarga</managed-bean-name> 
    <managed-bean-class>location.of.your.bean.ActionCadastrarCotacaoDadosCarga</managed-bean-class> 
    <managed-bean-scope>request</managed-bean-scope> 
       <!-- ^-IMPORTANT-^ --> 
</managed-bean> 
관련 문제