Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have some problems in your code:</p> <ul> <li>Every <code>UICommand</code> should be wrapped inside a <code>&lt;h:form&gt;</code> in order to work. Please refer to <a href="https://stackoverflow.com/q/2118656/1065197">commandButton/commandLink/ajax action/listener method not invoked or input value not updated</a>, section 1.</li> <li>You're not declaring the <code>actionListener</code> method in the right way, the method needs an <code>ActionEvent event</code> parameter. It looks like you wanted to use <code>action</code> instead. Refer to <a href="https://stackoverflow.com/q/3909267/1065197">Differences between action and actionListener</a> for more info.</li> <li>In RichFaces 4, there's no need to use <code>&lt;h:commandButon&gt;</code> together with <code>&lt;a4j:ajax&gt;</code>, this is the purpose of <code>&lt;a4j:commandButton&gt;</code>. From the documentation: <blockquote> <p>The component is similar to the JavaServer Faces (JSF) component, but additionally includes Ajax support.</p> </blockquote></li> </ul> <p>Tying all these advices together, your JSF code should be (I've omitted not necessary code to test the results like styles and rendered conditions)</p> <pre class="lang-html prettyprint-override"><code>&lt;a4j:outputPanel id="rep" &gt; &lt;rich:panel id="out"&gt; &lt;h:form id="frmCustomerData"&gt; &lt;h:panelGrid columns="2"&gt; &lt;a4j:commandButton value="Add New" action="#{adminBean.addCustAction}" render="setcust" /&gt; &lt;a4j:commandButton value="Delete" /&gt; &lt;/h:panelGrid&gt; &lt;rich:dataScroller for="setcust" style="margin-top: 17px"&gt;&lt;/rich:dataScroller&gt; &lt;rich:dataTable id="setcust" value="adminBean.customerList" var="custl" rows="10" style="width: 900px;margin-top: 5px"&gt; &lt;!-- datatable content... --&gt; &lt;/rich:dataTable&gt; &lt;/h:form&gt; &lt;/rich:panel&gt; &lt;/a4j:outputPanel&gt; </code></pre> <p>There's no need to make any change on the managed bean.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COAfter I put everything inside the form, CommandButton stopped working. It is not even calling the action method. I have changed my code and now call to datatable and action method is going fine but still , now I am facing another problem : I am getting following exception : javax.el.PropertyNotFoundException: /adminhome.xhtml @145,73 value="#{cust1.Id}": The class 'bank.persistence.entity.Customer' does not have the property 'Id'. But I have seen that I already have this property in my bean . I am updating above mentioned code.
      singulars
    2. CO@KshitijJain make sure you don't have nested `<h:form>`s in your code. Next time don't just copy/paste code blindly, instead adapt the posted code to your needs. Also, read the links and references in the answer, they're for providing more details on the suggestions. AFAIK you haven't changed the `<h:commandButton>` to `<a4j:commandButton>` as suggested (at least it's not in your actual edit).
      singulars
    3. COFirst of all Thanks very much for the links you have provided. They are really very helpful . I do not have nested forms in my code. And I have not updated code to include <a4j:commandButton> because that code was not working . Finally Now same code is working fine . I realized that I need to render complete panel again when I am adding a new row to the dataTable. So that everything along with Datascroller works fine. I am updating the correct code above . The problem related to BeanPropertyNot found was happening because I was putting fields with wrong naming conv. in Customer Bean .
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload