Taufik Pirjade
Taufik Pirjade

Reputation: 440

p:inputText values not coming in managed bean

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);
    }

Upvotes: 0

Views: 977

Answers (1)

ArnoldKem
ArnoldKem

Reputation: 90

Have you tried setting the ajax property of the command button to false?

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

This will reload the page and make sure that the form submissions will be completed.

Upvotes: -1

Related Questions