Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

<a4j:commandButton> Back end bean method is not invoked on click event.

833902Feb 8 2011 — edited Feb 11 2011
I am using below code. It seems back end bean method is not called when I click commandbutton. I think it has some thing to with rendering.


<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:cdm="http://mportal.com/cdm">
<ui:composition>
<rich:panel>
<a4j:form id="RefreshPropertiesInstanceForm">
<table id="RefreshPropertiesTable" width="100%" border="0">
<tr>
<td width="35%" align="right">
<div class="fieldLabel">Property File Name :<span
class="requiredField">*</span></div>
</td>
<td style="margin-top: 15px; padding-left: 15px" nowrap="nowrap"
align="left"><rich:comboBox id="combo"
value="#{testPropertyRefreshHelper.selectedPropertyFile}"
enableManualInput="false">
<f:selectItems value="#{testPropertyRefreshDetails.propertyFileNameList}" />
<a4j:support event="onchange"
reRender="RefreshPropertiesInstanceForm" BypassUpdates="false"
ajaxSingle="true" action="#{testPropertyRefreshHelper.getPropertyFileContentFromRemoteServer}" />
</rich:comboBox></td>
</tr>
<tr>
<td style="margin-top: 10px; padding-left: 100px" align="left"
colspan="3"><h:inputTextarea id="firstTextArea" value="#{testPropertyRefreshHelper.propertyFileContent}"
rows="21" cols="150"
style="overflow-x: auto; overflow-y: scroll"
rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
disabled="#{testPropertyRefreshHelper.selectedPropertyFile == 'Choose from below'}">
</h:inputTextarea></td>
</tr>

<tr>
<td style="margin-top: 10px; padding-left: 400px" align="left"
colspan="2">
<a4j:commandButton id='refreshPropertyButton' value="refresh"
image="#{imageManager.imageMap['REFRESH_BUTTON']}"
rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
action="#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}"
reRender="RefreshPropertiesInstanceForm" >
</a4j:commandButton>
</td>
</tr>
</table>

</a4j:form>
</rich:panel>
</ui:composition>
</html>

Every thing works perfectly. But when I click command button "#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}" backing bean method is not invoked. Other componenets are working properly.
This post has been answered by gimbal2 on Feb 11 2011
Jump to Answer

Comments

gimbal2
check the logs; perhaps you are getting validation errors?
833902
I tried checking this but could not make out. It seems below link is releveant for me. My bean is request scoped.

http://community.jboss.org/message/517697
833902
If any one has knowledge about this they can give more details.
gimbal2
Answer
try what the linked article says: make your bean session scoped.

NOTE: when working with Ajax I tend to make the backing bean session scoped to have less issues with partial updates and such. If you use JSF 2.0 you could make it view scoped to get the same result.
Marked as Answer by 833902 · Sep 27 2020
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 11 2011
Added on Feb 8 2011
4 comments
1,776 views