0
votes

I am providing a search function using JSF. I get the list and display it correctly in a datatable :

<p:dataTable id="props" var="prop" value="#{propController.propSearch}" editable="true" style="margin-bottom:20px">
    <p:column headerText="Id" width="20">                                       
        <h:outputText value="#{prop.id}" />
    </p:column>
    <p:column headerText="Name" width="300">                  
        <h:outputText value="#{prop.name}"/>                                                               
     </p:column>  
     <p:column headerText="Description">
         <h:outputText value="#{prop.shortDescription}" />                 
     </p:column>  
     <p:column headerText="Price" width="120">               
         <h:outputText value="#{prop.price}" />
     </p:column>  
     <p:column width="120">                 
         <h:commandButton value="View Prop" immediate="true" action="#{propController.viewSingleProp(prop)}" />                 
     </p:column>
     <p:column width="120">                 
         <h:commandButton value="Delete" immediate="true" onclick="return confirm('Are you sure you want to delete this prop?')" actionListener="#{propController.deleteProp(prop)}" />                                    
     </p:column> 

</p:dataTable>
</h:form>    

However the commandButton to view each individual item does not get called. Instead the search page just refreshes with no data.

Why is this happening?

1
How does the method viewSingleProp(prop) look like ?Omar

1 Answers

0
votes

(I hope your opening tag of <h:form> is just missing in your code posted in your question, not in your actual code!)

You need to remove the attribute immediate="true" from the h:commandButton.

See: