1

I am working on JSF 1.2 and RichFaces 3.3.1 GA.

I have one page which displays 100 rows in a rich:dataTable and the user will edit rows and submit the page. I'm keeping the bean in a request scope, because there is no Ajax functionality required (so I don't use ViewScoped/keepalive methods).

My problem is that after submitting the data I didn't get the dataTable values as a ArrayList in backing bean.

My JSF Page:

<h:form name="myform">
    Name : <h:inputText id="displayName" value="#{myBean.displayName}">
    <h:dataTable id="domainList" value="#{myArcBean.domainList}" var="dataItem">
        <f:facet name="header">
            <h:outputText value="Name" />
        </f:facet>
        <f:facet name="header">
            <h:outputText value="Password" />
        </f:facet>
        <f:facet name="header">
            <h:outputText value="Department" />
        </f:facet>
        <rich:column>
            <h:inputText id="name" value="#{dataItem.name}"/>
        </rich:column>
        <rich:column>
            <h:inputText id="password" value="#{dataItem.password}"/>
        </rich:column>
        <rich:column>
            <h:inputText id="department" value="#{dataItem.department}"/>
        </rich:column>
    </h:dataTable>
    <h:commandButton value="Save" type="submit" action="#{myArcBean.submit}" />
</h:form>

My Backing Bean :

public class MyArcBean  {

    private String dispalyName;
    private MyDomain mydomain = new MyDomain();
    private String[] list = new String[3];
    private List<MyDomain> domainList =  null;
    ArcUser loggedInUser = null;
    private HtmlInputHidden addCount = new HtmlInputHidden();

    public MyArcBean() {
    }

    public String loadData() {
        if(domainList==null)
            domainList = new ArrayList<MyDomain>();
        mydomain.setName("Munivel");
        mydomain.setDepartment("Houston");
        mydomain.setPassword("password");
        loadDataList();
        this.dispalyName="testName";
        return "MyArc";
    }

    public String submit() {
        System.out.println("The Name--->"+this.getDomainList());
        return "MyArc";
    }

    public void loadDataList() {
        domainList.add(new MyDomain("Muni","IT","password")); 
        domainList.add(new MyDomain("Vel","IT","password")); 
        domainList.add(new MyDomain("Hii","IT","password")); 
    }

    public HtmlInputHidden getAddCount() {
        return addCount;
    }

    public void setAddCount(HtmlInputHidden addCount) {
        this.addCount = addCount;
    }

    public HtmlDataTable getResReqRoleTable() {
        return resReqRoleTable;
    }

    // and standard getters and setters for:
    // dispalyName, mydomain, list and domainList
}

On page loading I'm calling loadData method. It loads the domainList values and displays the values as a dataTable. After I clicked the submit button I didn't get the domainList values from my backing Bean. I'm getting only the displayName property value.

Emil Sierżęga
  • 1,785
  • 2
  • 31
  • 38

0 Answers0