0

I have a page, that, when I select a Folder name, I populate two Components (<p:selectManyMenu> and <p:pickList>). How to I call two actions?

<p:selectOneMenu id="dirObj"
                 value="#{patchMB.patchBean.directoryObjetos}" 
                 style="width: 350px">

    <p:message for="dirObj"/>
    <f:selectItem itemLabel="Selecione" itemValue="Select"/>
    <f:selectItems value="#{patchMB.dirObjects}"/>
    <f:ajax event="change" listener="#{patchMB.loadFiles}" render="pickListArq"/>
</p:selectOneMenu>

Can I use two <f:ajax> event tags? I tried, and seems that it is executing each listener 2 times.

Here's the code for the second action:

<f:ajax event="change"
        listener="#{patchMB.carregarSelectMany}"
        render="objSelectMany" />
Tiny
  • 27,221
  • 105
  • 339
  • 599

1 Answers1

0

Why do you need two ajax calling? Couldn't popolate two components using just one action? Where did you put the second ajax event?

If you want execute two different methods on the same action, you can use a single ajax call and put the logic of the method2 in method1.

Otherwise, evaluate also to use valueChangeListener, it has different behaviour compared to ajax change. Read more on this post: When to use valueChangeListener or f:ajax listener?

Community
  • 1
  • 1
giaffa86
  • 708
  • 1
  • 9
  • 22
  • I use the tag render to fill another component. I don't access the components directly from java, there's a way I can access them(picklist and select many menu) from java? If it's possible ican execute 1 method and populate both. thank you – Carlos Junior Dec 12 '14 at 12:07