0

I created a separated Managed Bean to load State and City.

I need to pass State value to the Bean, but I getting a null value.

<p:selectOneMenu id="cgStage" value="#{order.cgState}"> 
    <f:selectItems  value="#{stateCityBean.lstState}" var="state"
        itemValue="#{state.cgState}" 
        itemLabel="#{state.noState}" />

    <p:ajax listener="#{stateCityBean.listCities}" update="cgCity">
        <f:setPropertyActionListener 
            target="#{stateCityBean.cgState}" 
            value="#{order.cgState}" />
    </p:ajax>               
</p:selectOneMenu>

<p:selectOneMenu id="cgCity" value="#{order.cgCity}">
...
</p:selectOneMenu>

Is there any way to get the SelectOneMenu value direct from component?

I tried get [copmonent.value], but didn't work either. Something like that:

<p:selectOneMenu ...
    <p:ajax listener="#{stateCityBean.listCities}" update="cgCity">
        <f:setPropertyActionListener 
            target="#{stateCityBean.cgState}" 
            value="#{component.value}" />
    </p:ajax>
</p:selectOneMenu>

Thank you guys

PS: I know I could do that with a [commandButton], but I'm using a template and the save button is outside my page.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rodrigo Tavares
  • 369
  • 3
  • 14
  • I think this is exactly what I need. I gonna make changes, and return here. Thank you again – Rodrigo Tavares Sep 03 '14 at 14:49
  • @BalusC, it worked perfectly as I wanted! Only one issue, why Eclipse is saying "Syntax error in EL"? Thank you again! – Rodrigo Tavares Sep 03 '14 at 15:15
  • Eclipse's being unaware of new EL 2.2 features. Perhaps you're using an old Eclipse version? – BalusC Sep 03 '14 at 15:47
  • @BalusC, Eclipse is the last version, but I found a [bug 276620](https://bugs.eclipse.org/bugs/show_bug.cgi?id=276620) about it. There is a pache to WTP 3.6, after applied the pache the warning gone. Thank you very much for your attention!:-) – Rodrigo Tavares Sep 03 '14 at 15:59

0 Answers0