12

So I have

<p:ajax event="tabChange" listener="#{refriedBean.onTabChange}" />

But I want to pass in the tabChange event AND an extra value that is stored on the page

public void onTabChange(TabChangeEvent event, Object obj)

How would one go about doing this?

Landister
  • 2,194
  • 7
  • 38
  • 56

1 Answers1

9

You can replace argument obj with additional property in bean and set needed value to this property on ajax request:

<p:ajax event="tabChange" listener="#{refriedBean.onTabChange}">
  <f:setPropertyActionListener target="#{refriedBean.additionalProperty}" value="value_here"/>
</p:ajax>

See setPropertyActionListener

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mikita Belahlazau
  • 15,326
  • 2
  • 38
  • 43
  • Nesting is by the way not necessary. It will be applied to the parent component anyway. – BalusC Feb 27 '12 at 21:36
  • 2
    It does have to be nested cause the parent must be of type ActionSource. Also It does not seem to be working. I made a value called additionalProperty in refriedBean and gave it a getter and setter. – Landister Feb 27 '12 at 21:53
  • 4
    @Angelo.Hannes http://stackoverflow.com/questions/15876257/fsetpropertyactionlistener-doesnt-set-the-value-however-action-is-triggered – kolobok Jul 09 '14 at 10:51
  • 1
    I don´t understand why this answer is upvoted. I just wanted to refer to the same Link like akapelko.... – marcel May 06 '15 at 08:28
  • It doesn't work for me either. Bean property is not set before listener handler. – Kragh Mar 07 '17 at 09:54