• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF dataTable parameter call problem

 
Paolo Pinkel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a strange problem I don't know how to fix.

I have a form with a dataTable that looks like this:


When I click the Update button, the saveProperty method is called, but the parameter (someHandler.newPropertyValue) is an empty string.

Does anyone know why?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action methods weren't designed to be invoked with parameters. The idea is that the entire form is going to have been validated and updated into your backing bean, and in fact, if any item submitted fails validation, the action method won't be invoked at all - the JSF lifecycle will short-circuit it and display validator error message(s).

The inputText control isn't supplied with a display value expression, it's supplied with a value reference expression. Going out, the current value of the bean property is displayed, but on submit, the reverse will happen. So you don't need a "newValue", the original value will have been automatically updated for you.

JSF is very different from other web frameworks and the #1 rule in JSF is that the more code and the more complexity, the more likely you're doing it wrong. They've tried to make the common functions as simple and easy as possible.
 
Paolo Pinkel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Tim.

But I still don't know how to fix it.

The reason why I use "newPropertyValue" and "propertyValue": I get the propertyValue from some other object. My getPropertyValue method calls some other method and I can't "set" that (yet). (I hope it's clear what I mean.) Maybe I'm thinking wrong... this seems like a common problem to me. I would like to have the propertyValue as the default value displayed in the inputText field, but I wan't changes to be bound to newPropertyValue. Hm. Maybe I could initialize the bean property, buuut... it's a dataTable. :O


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic