tags:

views:

39

answers:

1

Hello, I am trying to create 3 drop down menu for a form. First one, is LOB field. Second one is Application field and last one is CTA field. There is one to many relationship between LOB and Application. There is many to many relationship from Application to CTA.

CreateRequest.xhtml

        <h:selectOneMenu id="lobField" value="#{manager.lob}" required="true">
            <s:selectItems var="lob" value="#{lobs}" label="#{lob.lobDescription}" noSelectionLabel="Select LOB"></s:selectItems>
            <s:convertEntity />
            <a:support action="#{manager.loadApps}" ajaxSingle="true" event="onchange" reRender="appField,ctaField"/>
        </h:selectOneMenu>

        <a:outputPanel id="appField">
        <h:selectOneMenu value="#{manager.app}" required="true">
            <s:selectItems var="app" value="#{manager.applications}" label="#{app.applicationName}" noSelectionLabel="Select Application"></s:selectItems>
            <s:convertEntity />
            <a:support action="#{manager.loadCtas}" ajaxSingle="true" event="onchange" reRender="ctaField"/>
        </h:selectOneMenu>
       </a:outputPanel>

       <a:outputPanel id="ctaField">
       <h:selectOneMenu value="#{manager.cta}" required="true">
            <s:selectItems var="cta" value="#{manager.ctas}" label="#{cta.ctaDescription}" noSelectionLabel="Select CTA"></s:selectItems>
            <s:convertEntity />
       </h:selectOneMenu>

ManagerBean.java

@Stateful
@Name("manager")
public class ManagerBean implements Manager {
@Logger
private Log log;

@In
StatusMessages statusMessages;

private Lob lob;
private Application app;
private Cta cta;

@PersistenceContext(type = PersistenceContextType.EXTENDED)
EntityManager entityManager;

@Out(required = false)
private List<Lob> lobs;
private List<Application> applications;
private List<Cta> ctas;

public void CreateRequest() {
    System.out.println("Create Request");
    System.out.println(app.getApplicationName());
}

public Lob getLob() {
    return lob;
}

public void setLob(Lob lob) {
    this.lob = lob;
}

public Application getApp() {
    return app;
}

public void setApp(Application app) {
    this.app = app;
}

public Cta getCta() {
    return cta;
}

public void setCta(Cta cta) {
    this.cta = cta;
}

public List<Lob> getLobs() {
    return lobs;
}

public void setLobs(List<Lob> lobs) {
    this.lobs = lobs;
}

public List<Application> getApplications() {
    return applications;
}

public void setApplications(List<Application> applications) {
    this.applications = applications;
}

public List<Cta> getCtas() {
    return ctas;
}

public void setCtas(List<Cta> ctas) {
    this.ctas = ctas;
}

@Destroy
@Remove
public void destroy() {
}

@Factory("lobs")
public void loadLobs() {
    lobs = entityManager.createQuery("from Lob").getResultList();
}

public void loadApps() {
    System.out.println("load apps called");
    applications = lob.getApplicationList();
}

public void loadCtas() {
    System.out.println("load ctas called====");
    ctas = app.getCtaList();
    System.out.println(ctas.size());
}
}

I am able to select a value from LOB, and loadApps is called. Then I am able to select applications, too. But when I select one, I get following error:

19:09:01,921 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=managerForm:appField[severity=(ERROR 2), summary=(value is not valid), detail=(value is not valid)]

I am unable to figure out what mistake I am making here.

A: 

Are you in a conversation? Without specifying a scope your SFSB will be in the conversation context. Have you started the conversation?

bravocharlie
No, I haven't started a conversation. What scope would be appropriate for this kinda form? Page?
Nishant