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 valueChangeListener never being called Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "valueChangeListener never being called" Watch "valueChangeListener never being called" New topic
Author

valueChangeListener never being called

Daniel Breitner
Ranch Hand

Joined: Nov 13, 2008
Posts: 70
Hello Everybody,

I am using an ice:selectBooleanCheckbox together with a valueChangeListener like this:

<ice:selectBooleanCheckbox valueChangeListener="#{result.checkboxValueChangeListener}" value="#{result.selected}" />

But - no matter what I enter into the valueChangeListener property : nothing happens.
It seems as if the listener is completely being ignored.

Can anybody tell me what my error is ?

with kind regards

daniel


Visit me at http://liferay-blogging.blogspot.com
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14460
    
    7

valueChangeListener isn't a property. You have to define a valueChangeMethod with the proper signature. Something like this:



I don't know about providing a value on the tag. ValueChangeListeners are provided both the new and old values as part of the event. You should not, however, attempt to set a value into the monitored property yourself using the listener, since that's already part of the JSF lifecycle.


Customer surveys are for companies who didn't pay proper attention to begin with.
Daniel Breitner
Ranch Hand

Joined: Nov 13, 2008
Posts: 70
Hei - I found the solution

1) I wasn´t aware that icefaces (what we are using) ignores wrongly spelled listeners. Therefore I could enter whatever I want into the xhtml and there weren´t any errors.

2) I forgot using partialSubmit="true" which is mandatory when using listeners with icefaces. It enabled these calls.

Hooray !
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14460
    
    7

Daniel Breitner wrote:
I wasn´t aware that icefaces (what we are using) ignores wrongly spelled listeners. Therefore I could enter whatever I want into the xhtml and there weren´t any errors.


It's not just IceFaces. Almost any JSF expression whose method signature doesn't match what's expected will fail silently. I think there's supposed to be a good reason for that, but I don't know what it is and it's a real pain.

Ironically, one reason I support the slow, expensive development process over the instant-gratification platforms like Ruby on Rails is that Java catches and diagnoses more errors at compile-time. Unfortunately, EL isn't presently pre-compiled, so you lose that benefit just as you're preparing to display the data.
Jason Irwin
Ranch Hand

Joined: Jun 09, 2009
Posts: 327
I've only been playing with JSF for a short while, but I have found Eclipse to be pretty good at spotting dodgy EL statements. I am sure other IDEs do similar things too. Must admit, I have not tried to integrate it with IceFaces, but it might be worth seeing if your IDE offers similar features.

The only annoyance I have seen with Eclipse is that sometimes it flags things as being a potential problem when they are not and you need to close/open the file to get it to clear.


SCJP6
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14460
    
    7

The problem with depending on the IDE is that none of the ones I know of can detect semantic errors such as mis-spelled object names. Not all of them can even detect syntactic errors - I've been zapped more than once for forgetting that final "}" in an EL expression.

The XML/HTML Editor originally released with Eclipse 3.4 was horrible. Not only would it flag "errors" that weren't errors, it would drop quotes when reformatting, resulting in corrupted XML. Fortunately, they fixed that recently. Unfortunately, now the code suggestion facility keeps throwing exceptions. Sometimes I wonder how well they really test this stuff.

Then again, the biggest fault of all IDEs is that by providing basic assistance in the creation of complex constructs, they promulgate the practice of coding by people who don't have the faintest idea of what they're doing or what kind of atrocity they're actually creating.

I once inherited a Struts project. No IDE would have flagged what was wrong. For that matter, you could have gotten a perfect score on the (censored!) Struts test I was forced to take the other day and still not know what was wrong. But the minute more than 2 users logged in at the same time, it could go down like a house of cards. Not because of some obscure feature of the kind that litter exams (and which I keep reference books on in real life), but because the author didn't understand the fundamental restrictions of Struts.

I love IDEs. I love knowing what I'm doing even more, though!
 
I agree. Here's the link: http://jrebel.com/download
 
subject: valueChangeListener never being called
 
Similar Threads
rich:comboBox valueChangeListener is not working
valueChangeListener?
Is Backing bean Required
Issue With selectOneMenu ValueChangeListener Not Firing
Jsf rerender using javascript