ValueChangeEvent not firing when values are returned
In my jsf page I have a inputtext field and a hidden field. I have an edit button and upon clicking the edit button a popup screen appears and I selects a value and selected value returns back to my hidden field.
I added a valueChangeListener to my hidden field and added the following code in my bean.
public void processChange(ValueChangeEvent event){
try {
logger.info("event new value "+event.getNewValue().toString());
} catch (Exception ex) {
}
However every time when I change value using the edit popup window and returns value back to my hidden field, valueChangeListener is not firing I guess.
Any开发者_运维知识库 idea why valueChangeListener is not firing? My page scope is session and using JSF 1.1.
Idea behind this approach is to re-query and based on values from popup, I would like refresh data in JSF page.
You should not catch at first the most superclass Exception and especially without logging anything. Maybe your object from event.getNewValue() is null, then you get a NullPointerException and you don't will be noticed about that.
Use something like that:
public void processChange(ValueChangeEvent event){
try {
logger.info("event new value "+event.getNewValue().toString());
} catch (NullPointerException ex) {
logger.error("object is null: "+ex.getMessage());
} catch (Exception ex) {
logger.error(ex);
}
http://download.oracle.com/javase/tutorial/essential/exceptions/index.html
you have to submit the form. Add an onchage attribute in the tag which calls a javascript which submits the form. Until the form is submitted value changeevent wont be called.
精彩评论