0

I am creating a SelectOneMenu. The menu outputs correctly. However, along with the menu being outputted is an InputBox and then all the items of the menu being printed as text. I don't know what is causing it. I have included a image of the output below.

enter image description here

Here is my JSF code:

<p:panelGrid columns="2">                       
                        <h:outputLabel for="trader" value="Trader:" />
                        <p:selectOneMenu id="trader" value="#{fixBean.trader}">                          
                            <f:selectItem itemLabel="Select" itemValue="0" />
                            <f:selectItems value="#{fixBean.traderOption}" />                                                   
                        </p:selectOneMenu>  
                        </p:panelGrid>

Below is the code to my Bean:

private SelectItem[] traderOption = createFilterOptions(traders);
    private final static String[] traders;
    private static String trader = "";  
    static {
        traders = new String[9];        
        traders[0] = "Dowd";
        traders[1] = "Dwyer";
        traders[2] = "Edelman";
        traders[3] = "Hughes";
        traders[4] = "Kelley";
        traders[5] = "Nauyokas";
        traders[6] = "Options";
        traders[7] = "Rafferty";
        traders[8] = "Russillo";

    }

    public String getTrader() {
        return trader;
    }   
    public void setTrader(String trader) {
        this.traderOption = trader;
    }

    public void setTraderOption() {
        traderOption = createFilterOptions(traders);
    }   
    private SelectItem[] createFilterOptions(String[] data)  {  
        SelectItem[] options = new SelectItem[data.length + 1];  

        options[0] = new SelectItem("", "Select");  
        for(int i = 0; i < data.length; i++) {  
            options[i + 1] = new SelectItem(data[i], data[i]);  
        }  

        return options;  
    }  

    public SelectItem[] getTraderOption() {  
        return traderOption;  
    } 

The SelectMenu has the correct options in it however, I don't know why the rest of the output is being create (i.e. InputBox and text list).

****update**** I rebuilt the page using the primfaces SelectOneMenu example and built out from there. That resolved the issue. Though still not sure what was causing the issue

Cœur
  • 37,241
  • 25
  • 195
  • 267
Stevenyc091
  • 195
  • 1
  • 2
  • 22
  • Looks like you use your own stylesheets? I guess there is something wrong with the used CSS. Do you have the same behavior if you use the default primefaces-themes? – stg Dec 30 '13 at 01:10
  • I did not. I rebuilt the page from scratch starting with the primefaces default and built out from there. That resolved the issue. Still not sure of the cause but its working. Thanks. – Stevenyc091 Dec 30 '13 at 01:12

0 Answers0