JSF 2 : Status-Description selectonemenu

147 Views Asked by At

I have 2 selectonemenu elements, one that contains the status of the request, and the other contains a description of that status.

Im trying to implement it as follows :

I have a class called status that has 2 fields : status & description.

the selectonemenu would be :

<h:outputText id="requestStatusH" value="Status : " />
<h:selectOneMenu id="statusDD" value="#{exApp.status}">
    <f:selectItems value="#{exApp.statusList}" />
</h:selectOneMenu>

and my exApp bean would be :

private RequestStatus status;
private List<RequestStatus> statusList;
//Getters + Setters

when i select a status in one selectonemenu i want the corresponding description to appear in another disabled selectonemenu.

The problem is that im not able to even get the selected value in to the backing bean variables. after i submit the page, nothing is happening.

I tried to look into the stackoverflow selectonemenu guide, and i couldnt find anything about converters.

any help would be highly appreciated.

Edit :

My RequestStatus code :

public class RequestStatus implements Serializable {
public RequestStatus(String status, String description) {
    this.status = status;
    Description = description;
}

private String status;
private String Description;
//Getters + Setters

my form :

<h:form>
    <p:commandLink id="saveChanges" value="Save Changes" actionListener=
        "#{exApp.saveRespond()}"> </p:commandLink>
    <h:outputText id="requestStatusH" value="Status : " />
    <h:selectOneMenu id="statusDD" value="#{exApp.status}">
        <f:selectItems value="#{exApp.statusList}" />
    </h:selectOneMenu>
</h:form>

RequestStatus Class is not a backing bean, its a POJO that is used as a field in the RequestScope exApp backing bean. my page is using Form. and when i submit my form NOTHING happens.

0

There are 0 best solutions below