Here is situation I had. There is JSF page with the form, some input fields and button that should call action on managed bean. When you click the button action should be called but nothing happens. There is no error displayed nor you can find out where the call is lost. After some investigation it turned out that this appear each time when JSF does not succeed to map values form page to values in managed bean. But there is no clue which values are not binded correctly. I know this is validation and conversion problem and in some cases immediate="true" should solve the problem but in my case even that didn't help.
So how do I solve such situations. There is no straightforward solution for this but following should work in the most of the cases:
Remove field by field in your JSF page. Then redeploy application and try if your method works. Maybe even you need to remove combination of fields to make your action being called.
When you find out which field(s) are cause of the problems you can concentrate on those fields and solve the problem.
What I found out in my cases was:
- Once setter I used was not of void type but returned some value. JSF didn't accept this return value
- Once setter I used was throwing RunTimeException that was not handled correctly
24 comments:
Thank you very much. It was a big problem for me to fix it in a complex page without any errors dumped
Its amazing this happens in JSF its a big time waster
That makes me think Java sucks...
@matheus
Because of the bug in a web framework based on Java I wouldn't come to the conclusion that Java sucks.
Dudes, I agree there should be better feedback from the JSF implementation you're using.
However, the framework relies on Java Beans. There are specific conventions for what constitutes a property on a bean. A setter that doesn't return void is not a bean property and therefore won't be used as a property.
Not sure if your JSF impl will tell you when it can't find properties, but the h:messages tag is supposed to provide JSF error feedback.
Matheus, this has nothing to do with Java. Your comment is the equivalent of saying computers suck.
Same problem. Drives me up a wall. Make me think JBoss is a toy. We should at least see an error message in the log.
Yupe there should be some logging msgs even to track the flow atleast. i used the debug to track out the issue and came to see the contraol returning back driectly from JSF jars itself. Even no logs...
I know this posting is old, but in my case I had a rendered attribute on my commandButton. If the rendered attribute resolves to false when the commandButton is clicked the defined action does not get called.
Hi,
Thanks for the blog.. The way I see jsf *&^*%&&^ is modelled after .net crap and this wastes tonnes and tonnes of time... and if you are stuck, then good luck.. just like .net you will be lucky to get any help.
Such a waste of time. Spring or even Struts was so swift and cleaner. Yes, jsf saves (again if you are lucky) some time in sorting tables and all those craps... but jsf is not worth any effort... it is big shame on open source and people who write code for jsf should be sent to MS corp for testing.
.......
Hey Jan,
Thanks for this info.
If this helps anyone, I had this "action not being called without any error message" thing because I declared the myfaces extension filter in web.xml but somehow forgot to map it to jsf servlet. My form with a tag didnt call the backing beans action nor raised any exceptions or log messages. Took me like an hour. It was dreadfull.
Another reason this issue can happen (that we came to know spending few hours) is when commandButton is placed inside the verbatim tag...
Thank you so much !! this helped solve my problem. I had spent close to 4 hours trying to figure it out before I saw your post.
I've had the same problem. A non-working button, because of an action that wasn't called. In my case, it turned out that the problem was that the actionbutton had some properties that read from a request-scope-bean (rendered, value) Since the bean had request scope, the values were lost before i clicked the actual button. (after rendering the page with the button on it) After changing the bean scope to session, the problem disappeared.
Thanks, it was informative and hlepd me fix a bug.
solved my problem too.. same problem as jan, bean had some properties that were getting lost when scope was set to request. Changed the scope back to session and it worked like a charm. Extremely annoying bug in jsf though hope this improves with newer releases.
This solved my problem. Thank you very much. I've searched about this problem for a long time and this information is very helpful for me.
it took me a hours, thanks a lot for your post
Thanks a lot. This helps. Searched many other post for this problem but none of them helped. You are the best!
Thanks for you help!!
Roberto
The type attribute must be "submit" or "reset".
The "button" type works for javascript i guess...
The type attribute must be "submit" or "reset".
The "button" type works for javascript i guess...
Man...thanks you very much!!
Thanks.. that helped me when I was trying everything and failing.
Post a Comment