Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

valueChangeListener never being called  RSS feed

 
Daniel Breitner
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Daniel Breitner
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!