File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Ajax Listener does not get called properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Ajax Listener does not get called properly" Watch "Ajax Listener does not get called properly" New topic
Author

Ajax Listener does not get called properly

Jussi Taimiaho
Ranch Hand

Joined: Mar 01, 2004
Posts: 40
I am trying to use ajax for populating some data to a drop-down based on contents of another dropdown. I have built one version, which works fine, but is against the SW integrity - and that is what I wish to fix.

My jsf:

My Bean:


Now this works just fine. When I change something in my form, my setDepartmentGroup gets called, the Listener gets a call, and my "department" -component is re-rendered with new values as per the call to "SelectItemUtil.departmentListByGroupCode".

However I have in my bean a reference to entity bean:
My Bean:

/The Decision -object has property "DepartmentGroup", where the data should go and stay. Now however, if I write my jsf:

<h:selectOneMenu label="#{msgs.mcd_department_group}" id="deptgroup" value="#{cc.attrs.decisionHandler.decision.departmentGroup}" >
<f:selectItems value="#{cc.attrs.decisionHandler.departmentGroupList}"/>
<f:ajax render="department" listener="#{cc.attrs.decisionHandler.departmentGroupListener}" />
</h:selectOneMenu>

My Listener -method does not get the call. Now can someone tell me why the Listener does not get called when I bind my form value to a property in another class? Any help is highly appreciated...



Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

The fact that your property is in some other bean makes no difference. However, there is a validator restriction that says that if that bean's property is not in the selectItem list, you'll get a validation error and backing bean action methods (including AJAX ones) won't fire. You're even more likely to see that situation if the value expression for the listbox references a bean not yet assigned (that is, departmentGroup cannot be resolved because "department" is null).

Add an h:messages tag to the page with global message display enabled and you should see the error.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax Listener does not get called properly