You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mi...@recommind.com> on 2009/12/16 11:51:17 UTC

updateActionListener in JSF 1.2 - exec before outer action possible?

Hi,

What's the recommended migration for tomahawk updateActionListener from JSF 1.1 to 1.2? I did not find any helpful hints so far.

In JSF 1.1 the updateActionListener was called before the Action/ActionListener of the outer command.
In JSF 1.2 the order has changed apparently. The component actionListener is invoked and then nested actionListeners.

f:setPropertyActionListener can be used but it is called after the outer command.
And the outer command is called twice in my case.

Is f:actionListener an alternative for Actions (not ActionListeners)? I didn't get this working.

JSF 1.1:
<t:commandButton id="acmd1" actionListener="#{MyController.doIt}"
  <t:updateActionListener property="#{MyController.stateId}" value="bean.value"/>
</tcommandButton>

Flow:
MyController.setStateId()
MyController.doIt()

JSF 1.2
<t:commandLink id="acmd1" action="#{MyController.doIt}">
  <f:setPropertyActionListener target="#{MyController.stateId}" value="#{bean.value}"/>
</t:commandLink>

Flow:
MyController.doIt()
MyController.setStateId()
MyController.doIt()

How did other people solve this?

Michael

RE: updateActionListener in JSF 1.2 - exec before outer action possible?

Posted by Michael Heinen <mi...@recommind.com>.
Damn copy paste error. I meant in JSF 1.1 of course:

<t:commandButton id="acmd1" action="#{MyController.doIt}">



-----Original Message-----
From: Michael Heinen [mailto:michael.heinen@recommind.com] 
Sent: Mittwoch, 16. Dezember 2009 11:51
To: MyFaces Discussion
Subject: updateActionListener in JSF 1.2 - exec before outer action possible?

Hi,

What's the recommended migration for tomahawk updateActionListener from JSF 1.1 to 1.2? I did not find any helpful hints so far.

In JSF 1.1 the updateActionListener was called before the Action/ActionListener of the outer command.
In JSF 1.2 the order has changed apparently. The component actionListener is invoked and then nested actionListeners.

f:setPropertyActionListener can be used but it is called after the outer command.
And the outer command is called twice in my case.

Is f:actionListener an alternative for Actions (not ActionListeners)? I didn't get this working.

JSF 1.1:
<t:commandButton id="acmd1" actionListener="#{MyController.doIt}"
  <t:updateActionListener property="#{MyController.stateId}" value="bean.value"/>
</tcommandButton>

Flow:
MyController.setStateId()
MyController.doIt()

JSF 1.2
<t:commandLink id="acmd1" action="#{MyController.doIt}">
  <f:setPropertyActionListener target="#{MyController.stateId}" value="#{bean.value}"/>
</t:commandLink>

Flow:
MyController.doIt()
MyController.setStateId()
MyController.doIt()

How did other people solve this?

Michael

RE: updateActionListener in JSF 1.2 - exec before outer action possible?

Posted by Michael Heinen <mi...@recommind.com>.
Mike, you are right, it is working as expected.

The first call of doIt() in my sample was caused by lazy initialization from faces-config.

I'm sorry for this wrong report and wasting time, I was confused due to so many problems in the last days.
Got today a working beta from richfaces which enables ajax rerendering again.
This migration is killing me...

Michael

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: Mittwoch, 16. Dezember 2009 15:54
To: MyFaces Discussion
Subject: Re: updateActionListener in JSF 1.2 - exec before outer action possible?

Sorry, that last example should have been:

		<h:commandButton action="#{test.doItTest1}" actionListener="#{test.execute}">
		 <t:updateActionListener property="#{test.stringValue}" value="one"/>
		 <t:updateActionListener property="#{test.stringValue}" value="two"/>
		</h:commandButton>

I cut and paste the wrong part of the page code.


On Wed, Dec 16, 2009 at 9:46 AM, Mike Kienenberger <mk...@gmail.com> wrote:
> I am using Myfaces Core 1.2.8, Facelets 1.1.14, and Myfaces Tomahawk 1.1.9.
>
> I'm not seeing the problems you are having.  Perhaps it is because of facelets.
>
> I wrote some simple tests, and here's what I got for the most complicated one:
>
>                <h:commandButton action="#{test.doItTest1}" actionListener="#{test.execute}">
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
>                </h:commandButton>
>
> TestBean: execute()
> TestBean: setStringValue()=one
> TestBean: setStringValue()=two
> TestBean: doItTest1()
>
> If you have something specific, I'll give that a try, but I started
> with your original examples.
>
>
> I mixed in some t:updateALs, and the only thing that didn't work was
> multiple t:UALs.  Another reason not to use it.
>
>                <h:commandButton action="#{test.doItTest1}">
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
>                </h:commandButton>
>
> TestBean: execute()
> TestBean: setStringValue()=one
> TestBean: doItTest1()
>
>
> On Wed, Dec 16, 2009 at 5:51 AM, Michael Heinen
> <mi...@recommind.com> wrote:
>> Hi,
>>
>> What's the recommended migration for tomahawk updateActionListener from JSF 1.1 to 1.2? I did not find any helpful hints so far.
>>
>> In JSF 1.1 the updateActionListener was called before the Action/ActionListener of the outer command.
>> In JSF 1.2 the order has changed apparently. The component actionListener is invoked and then nested actionListeners.
>>
>> f:setPropertyActionListener can be used but it is called after the outer command.
>> And the outer command is called twice in my case.
>>
>> Is f:actionListener an alternative for Actions (not ActionListeners)? I didn't get this working.
>>
>> JSF 1.1:
>> <t:commandButton id="acmd1" actionListener="#{MyController.doIt}"
>>  <t:updateActionListener property="#{MyController.stateId}" value="bean.value"/>
>> </tcommandButton>
>>
>> Flow:
>> MyController.setStateId()
>> MyController.doIt()
>>
>> JSF 1.2
>> <t:commandLink id="acmd1" action="#{MyController.doIt}">
>>  <f:setPropertyActionListener target="#{MyController.stateId}" value="#{bean.value}"/>
>> </t:commandLink>
>>
>> Flow:
>> MyController.doIt()
>> MyController.setStateId()
>> MyController.doIt()
>>
>> How did other people solve this?
>>
>> Michael
>>
>


Re: updateActionListener in JSF 1.2 - exec before outer action possible?

Posted by Mike Kienenberger <mk...@gmail.com>.
Sorry, that last example should have been:

		<h:commandButton action="#{test.doItTest1}" actionListener="#{test.execute}">
		 <t:updateActionListener property="#{test.stringValue}" value="one"/>
		 <t:updateActionListener property="#{test.stringValue}" value="two"/>
		</h:commandButton>

I cut and paste the wrong part of the page code.


On Wed, Dec 16, 2009 at 9:46 AM, Mike Kienenberger <mk...@gmail.com> wrote:
> I am using Myfaces Core 1.2.8, Facelets 1.1.14, and Myfaces Tomahawk 1.1.9.
>
> I'm not seeing the problems you are having.  Perhaps it is because of facelets.
>
> I wrote some simple tests, and here's what I got for the most complicated one:
>
>                <h:commandButton action="#{test.doItTest1}" actionListener="#{test.execute}">
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
>                </h:commandButton>
>
> TestBean: execute()
> TestBean: setStringValue()=one
> TestBean: setStringValue()=two
> TestBean: doItTest1()
>
> If you have something specific, I'll give that a try, but I started
> with your original examples.
>
>
> I mixed in some t:updateALs, and the only thing that didn't work was
> multiple t:UALs.  Another reason not to use it.
>
>                <h:commandButton action="#{test.doItTest1}">
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
>                 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
>                </h:commandButton>
>
> TestBean: execute()
> TestBean: setStringValue()=one
> TestBean: doItTest1()
>
>
> On Wed, Dec 16, 2009 at 5:51 AM, Michael Heinen
> <mi...@recommind.com> wrote:
>> Hi,
>>
>> What's the recommended migration for tomahawk updateActionListener from JSF 1.1 to 1.2? I did not find any helpful hints so far.
>>
>> In JSF 1.1 the updateActionListener was called before the Action/ActionListener of the outer command.
>> In JSF 1.2 the order has changed apparently. The component actionListener is invoked and then nested actionListeners.
>>
>> f:setPropertyActionListener can be used but it is called after the outer command.
>> And the outer command is called twice in my case.
>>
>> Is f:actionListener an alternative for Actions (not ActionListeners)? I didn't get this working.
>>
>> JSF 1.1:
>> <t:commandButton id="acmd1" actionListener="#{MyController.doIt}"
>>  <t:updateActionListener property="#{MyController.stateId}" value="bean.value"/>
>> </tcommandButton>
>>
>> Flow:
>> MyController.setStateId()
>> MyController.doIt()
>>
>> JSF 1.2
>> <t:commandLink id="acmd1" action="#{MyController.doIt}">
>>  <f:setPropertyActionListener target="#{MyController.stateId}" value="#{bean.value}"/>
>> </t:commandLink>
>>
>> Flow:
>> MyController.doIt()
>> MyController.setStateId()
>> MyController.doIt()
>>
>> How did other people solve this?
>>
>> Michael
>>
>

Re: updateActionListener in JSF 1.2 - exec before outer action possible?

Posted by Mike Kienenberger <mk...@gmail.com>.
I am using Myfaces Core 1.2.8, Facelets 1.1.14, and Myfaces Tomahawk 1.1.9.

I'm not seeing the problems you are having.  Perhaps it is because of facelets.

I wrote some simple tests, and here's what I got for the most complicated one:

		<h:commandButton action="#{test.doItTest1}" actionListener="#{test.execute}">
		 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
		 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
		</h:commandButton>

TestBean: execute()
TestBean: setStringValue()=one
TestBean: setStringValue()=two
TestBean: doItTest1()

If you have something specific, I'll give that a try, but I started
with your original examples.


I mixed in some t:updateALs, and the only thing that didn't work was
multiple t:UALs.  Another reason not to use it.

		<h:commandButton action="#{test.doItTest1}">
		 <f:setPropertyActionListener target="#{test.stringValue}" value="one"/>
		 <f:setPropertyActionListener target="#{test.stringValue}" value="two"/>
		</h:commandButton>

TestBean: execute()
TestBean: setStringValue()=one
TestBean: doItTest1()


On Wed, Dec 16, 2009 at 5:51 AM, Michael Heinen
<mi...@recommind.com> wrote:
> Hi,
>
> What's the recommended migration for tomahawk updateActionListener from JSF 1.1 to 1.2? I did not find any helpful hints so far.
>
> In JSF 1.1 the updateActionListener was called before the Action/ActionListener of the outer command.
> In JSF 1.2 the order has changed apparently. The component actionListener is invoked and then nested actionListeners.
>
> f:setPropertyActionListener can be used but it is called after the outer command.
> And the outer command is called twice in my case.
>
> Is f:actionListener an alternative for Actions (not ActionListeners)? I didn't get this working.
>
> JSF 1.1:
> <t:commandButton id="acmd1" actionListener="#{MyController.doIt}"
>  <t:updateActionListener property="#{MyController.stateId}" value="bean.value"/>
> </tcommandButton>
>
> Flow:
> MyController.setStateId()
> MyController.doIt()
>
> JSF 1.2
> <t:commandLink id="acmd1" action="#{MyController.doIt}">
>  <f:setPropertyActionListener target="#{MyController.stateId}" value="#{bean.value}"/>
> </t:commandLink>
>
> Flow:
> MyController.doIt()
> MyController.setStateId()
> MyController.doIt()
>
> How did other people solve this?
>
> Michael
>