0

I'm stuck on a problem in JSF since this morning.

I have firetrucks and button to handle them. Everything works except the selectOneMenu (primefaces component)

The interface of my application

As you can see, I have one selectOneMenu associate to the "breakdown" button.

So my choices are BcmsSessionFireTruck.

FSC.xhtml

<p:selectOneMenu value="#{FSC.FT_replacement}" style="width:150px">
    <f:selectItem itemLabel="Select City" itemValue=""    noSelectionOption="true" />
    <f:selectItems value="#{FSC.bcmsSessionsFT}" />
</p:selectOneMenu>
<p:commandButton value="BreakDown" actionListener="#{FSC.fire_truck_breakdown('FT1')}"/>

And my Managed Bean :

private  List<BcmsSessionFireTruck> _BcmsSessionsFT;
private BcmsSessionFireTruck FT_replacement;
[...]
    public List<BcmsSessionFireTruck> getBcmsSessionsFT() {
    return _BcmsSessionsFT;
}

public void setBcmsSessionsFT(List<BcmsSessionFireTruck> _BcmsSessionsFT) {
    this._BcmsSessionsFT = _BcmsSessionsFT;
}

public BcmsSessionFireTruck getFT_replacement() {
    return FT_replacement;
}

public void setFT_replacement(BcmsSessionFireTruck FT_replacement) {
    this.FT_replacement = FT_replacement;
}

public void fire_truck_breakdown(String fire_truck)
{

    System.out.println("IN fire truck bearkdown");
    System.out.println(this.FT_replacement.getFireTruckStatus());
    //this.load_data();
}

My issue is when I choose a selectOneMenu nothing happens in my form. I can click on breakdown but nothing happens, no errors et no logs.


So I tested with a simply object. I changed my code to put a String Array. And when i did this the code worked.

Do you have any ideas, why I have a problem and what is it ?

Thank you Thomas B.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Thomas B.
  • 29
  • 2
  • Please, please use the Java naming convention on your classes. Aside that you problem is because you are using a complex object in a selecOne component. You need to use a converter so JSF can understand what you are trying to pass to it. There are many answered questions here about it. See this one: http://stackoverflow.com/questions/28742165/primefaces-selectonemenu-converter-called-but-not-working for instance – Jorge Campos Dec 15 '15 at 13:31
  • BalusC the problem isn't that you explained. The dropdown is lined red because before print screen I click on another button (so it's good). The problem was resolved. Jorge Campos had right, i resolve my problem ty. – Thomas B. Dec 15 '15 at 13:51

0 Answers0