p:inputText values not coming in managed bean

时间:2016-04-07 10:34:57

标签: jsf primefaces treetable

I have p:treeTable in which i am having columns which contains all the text fields now after submitting form i want values inside p:inputText in managed bean which is not coming

TreeTable:

   <h:form id="myform">
            <p:dialog header="" widgetVar="dlg1" height="200" width="200" dynamic="true">
                <p:ajax event="close"  listener="#{popupTreeTableManagedBean.setScanParamsSubRootListNull}" />
               <p:treeTable value="#{popupTreeTableManagedBean.root}" var="node" style="" >

                    <p:column>
                        <f:facet name="header">
                            Name
                        </f:facet>
                        <h:outputText value="#{node.name}"></h:outputText>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            Value
                        </f:facet>
                        <p:inputText value="#{node.value}" style="border-style: hidden;" immediate="true"/>
                    </p:column> 
        </p:treeTable>

                <p:commandButton value="Save" onclick="loadValues();" actionListener="#{popupTreeTableManagedBean.handleSaveButton}"/>

           </p:dialog> 
        </h:form>

MaangedBean :

public void handleSaveButton() {

        int i = scanRoot.getChildren().size();
        Iterator itr = scanRoot.getChildren().iterator();
         HashMap<String,String> valueNameHashMap = new HashMap<String,String>();

        while(itr.hasNext()) {
            Object trc = itr.next();
            DefaultTreeNode newDocument = (DefaultTreeNode) trc;
            Document newData =(Document) newDocument.getData();

            String nameOfVariable = newData.getName();
            String value = newData.getValue();
        }

         System.out.println(valueNameHashMap);
    }

1 个答案:

答案 0 :(得分:-1)

您是否尝试过将命令按钮的ajax属性设置为false?

  <p:commandButton value="Save" ajax="false" actionListener="#{popupTreeTableManagedBean.handleSaveButton}"/>

这将重新加载页面并确保表单提交完成。