setActionListener no longer executed (first) in combination with actionListener after switching to Facelets

StackOverflow https://stackoverflow.com/questions/21629005

سؤال

We have this Trinidad 1.2 application which we converted to use Facelets (1.1.14) recently. Most of the problems we were able to solve using some find and replace actions. Now we ran into an issue I was unable to solve without modifying multiple instances of code.

The problem is that if we use an actionListener on a command button in combination with a child <tr:setActionListener />:

<tr:commandButton actionListener="#{someBean.toggleSomeObject}"
                  immediate="true"
                  ...>
  <tr:setActionListener from="#{rowObject}" to="#{someBean.someObject}"/>
</tr:commandButton>

After switching to Facelets the <tr:setActionListener /> is no longer executed (first). I tried replacing the <tr:setActionListener /> with a <f:setPropertyActionListener />, but the result was the same.

The only option I can think of is using an <f:attribute/> and read the attribute in the action listener, but that would require me to change several action listener methods.

I hope there are other options which requires less work.

هل كانت مفيدة؟

المحلول

This behavior is expected. That it "worked" previously is just caused by a bug. You should not rely on buggy behavior.

Use <tr:commandButton action> instead (and don't forget to get rid of ActionEvent argument).

See also:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top