Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spurious valueChangeListener calls on same JSP page  RSS feed

 
jack catler
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a number selectOneListbox items on the same JSP page.

They are logically connected in a tree type structure, selecting list A will fill list B, selecting list B will fill list C and so on. I also clear the lists as required.

Each list has a Listener handler valueChangeListener which performs a number of actions:
- Gets the new value.
- clears the current list.
- Updates the lists based on the selection.

Works OK 50% of the time but then depending on sequence (and luck/timing?), some selections of list items (up the tree) cause the valueChangeListener events of other lists to be fired with null/unselected values. I have done some searching and I believe it's a timing issue but thats all I can determine. I am quite new JSF...


Example of the list declerations follows...

<tr><td>List A</td></tr>
<tr><td>
<h:selectOneListbox immediate="true" onchange="submit()"valueChangeListener="#{myclass.listAChanged}">
<f:selectItems value="#{myclass.listA}" />
</h:selectOneListbox>
</td></tr>

<tr><td>List B</td></tr>
<tr><td>
<h:selectOneListbox immediate="true" onchange="submit()"
valueChangeListener=" {myclass.listBChanged}">
<f:selectItems value="#{myclass.listB}" />
</h:selectOneListbox>
</td></tr>

<tr><td>List C</td></tr>
<tr><td>
<h:selectOneListbox immediate="true" onchange="submit()"
valueChangeListener="#{myclass.listCChanged}">
<f:selectItems value="#{myclass.listC}" />
</h:selectOneListbox>
</td></tr>

Example of valueChangeListener follows...

public void listAChanged(ValueChangeEvent event){

FacesContext fc = getFacesContext();
String newAString = (String)event.getNewValue();

// listB is a Map object...
listB = getNewBList(newAString);
listC.clear();


fc.renderResponse();
}


When I play around with the list selection screen I get (without explanation) null events or events that refer to lower lists (say listC) without even having selected them...it is kinda driving me el nutso...

Any tips greatly appreciated.

Thanks
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you find a solution to your problem?
I have the same problem (i.e. several value change listener methods) and would be grateful for your help?
Julien.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!