当前位置: 动力学知识库 > 问答 > 编程问答 >

jsf - Not able to access input text value using blur event

问题描述:

I have what I thought was a straight forward task.

I have a Primefaces p:inputText field that I need to use after I navigate out of that field. I am using p:ajax event="blur" to initiate the backing bean processing. That seems to work OK, but when I look at the value that should be in the inputText field, it is coming back as null in the backing bean.

Here is the code I have: Input text component:

<p:inputText id="redirectionDocIdInput" size="21"

rendered="#{!isInquiryMode}"

onkeyup="this.value = this.value.toUpperCase();"

value="#{redirectionForm.redirectDocId}" >

<p:ajax event="blur" listener="#{redirectionController.findRedirectDocFromId(redirectionForm)}"

update=":tabView:redirectionForm:redirectionMessages :#{p:component('authDocLaInput')}" />

</p:inputText>

And here is the backing bean:

public void findRedirectDocFromId( RedirectionForm form ) {

String docId = form.getRedirectDocId();

Document redirDoc = searchService.getDocumentByDocumentId(docId);

if( redirDoc == null ) {

MessageUtils.addFacesErrorMessage("Document Id ("+docId+") not found.");

return;

}

form.setRedirectDoc(redirDoc);

form.setAuthDocLA(redirDoc.getLandAreaCode());

form.setRedirectDocId(docId);

}

I can set a break point in the backing bean and I see a valid component value for the form, but the redirectDocId is coming back null.

What am I doing wrong, or what do I need to add?

Thanks.

分享给朋友:
您可能感兴趣的文章:
随机阅读: