0

in my JSF I have the following code:

 <p:outputLabel value="Area" for="area" />
 <p:selectOneMenu value="#{addActionView.area}" id="area">
   <f:selectItems value="#{addActionView.areas}" />
 </p:selectOneMenu>     

 <p:commandButton value="Save" action="#{addActionView.save}" />

AddActionView.java:

    public List<Area> getAreas() {
    List<Area> result = new LinkedList<Area>();
            ... fill in Values
    return result;
}

private Area area;

public Area getArea() {
    return area;
}

public void setArea(Area bereich) {
    this.area = bereich;
}

When I click on the command button nothing happens. When I remove the selectOneMenu the page works as expected. Where is my fault?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
matthias
  • 1,938
  • 23
  • 51
  • 1
    'Nothing happens' is not smart. Check the server, check what the client logs check with a added messages component in the page etc... do some basic jsf debugging. Most likely: missing converter that is required since you seem to be using 'Objects' not Strings in the selectone menu – Kukeltje Sep 28 '15 at 13:26
  • There are even no log messages... – matthias Sep 28 '15 at 13:30
  • possible duplicate of [commandLink/commandButton/ajax backing bean action/listener method not invoked](http://stackoverflow.com/questions/2118656/commandlink-commandbutton-ajax-backing-bean-action-listener-method-not-invoked) – Kukeltje Sep 28 '15 at 14:07
  • I do not see the `save()` method in the managed bean. Did you accidentally forget to post it or did not include deliberately in the post? Did you define that method in the bean associated? – Tiny Sep 28 '15 at 14:58
  • Add ``. Do you see any messages now? – BalusC Sep 28 '15 at 15:46

1 Answers1

-2

I'm not sure if this is entirely necessary but I have my list of selection option as an instance of the class javax.faces.model.SelectItem;, and not something that I have defined myself.

JSF needs to know which attributes to display in the from your instances of your Class Area in thedrop down box so you can assume that you have to use an in-built Class or specify that the id is area.getId() and the string to display is area.getString() etc.

However, I don't even know if this answer addresses your problem because the problem asked in the question is unclear.