Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to integrate results from RESTful api with JSF?
    text
    copied!<p>How to pass results from RESTful service to JSF components? I read many postings, but couldn't find a straightforward method. Using RESTful APIs wherever possible is the main requirement for my application. Performance is also a key as thousands of data elements will be processed in a day. If I can't find a solution in JSF, I might have to switch to another technology..</p> <p>Therefore, I'm asking in case I'm missing something completely from other postings since I'm new. Here are a couple of simple scenarios. </p> <p>On a JSF page, there is a datatable (Primefaces Checkbox based selection). The datatable displays records available (up to thousands). The datatable needs to be loaded through a RESTful api on the fly. Below is the code for my datatable. </p> <pre><code> &lt;p:dataTable id="addSampleTable" var="sample" value="#{testBean.sampleDataModel}" selection="#{testBean.selectedSamples}" &gt; &lt;p:column selectionMode="multiple" style="width:2%" /&gt; &lt;p:column headerText="Sample"&gt; &lt;h:outputText value="#{sample.name}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; </code></pre> <p>What's the best way to load the data? Is there a performance concern if every time I have to call the API from the server side (as opposed to client side using jquery and plain html)? </p> <p>Second scenario, on the same page, there is also a button that allows user to add new record through another RESTful api. In turn, the newly added record should be displayed in the datatable. </p> <p>After I call the RESTful API to insert a record, the api also returns the record that was created. How can I insert this new record into my datamodel #{testBean.sampleDataModel} so that I don't have to load the entire table again? I suppose I can replace this datatable with plain html and append the new record to the table using jQuery, but then I can't leverage the selection table from JSF. </p> <p>What are my options? </p>
 

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