Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Performance issues in the situation you describe are often caused by the <strong>large number of EL expressions</strong>, That burdens the server.</p> <p>One approach to tackle this issue is to compute the comments on the client side, and pass them all at once to the server. Thus <strong>reducing the number of comment EL expression</strong> to one or none, and use only one button. </p> <p>Place all the elements in one form. The comments fields are not binded. </p> <pre><code> &lt;h:form&gt; // first element &lt;h:outputText value=#{first element} // first comment &lt;h:inputTextarea id="comment1"/&gt; &lt;-- notice there is no EL expression But we use a unique id for each comment // second element &lt;h:outputText value=#{second element} // second comment &lt;h:inputTextarea id="comment2"/&gt; . . . &lt;/h:form&gt; </code></pre> <p>From here you could either</p> <p><strong>1.</strong> after each blur event in any of the comment fields, <strong>ajax</strong> the server and pass as parameters the <em>comment</em> and the <em>id</em> of the comment from which the ajax call was made. on the server update your model accordingly </p> <p>Or You can also gather all the comments on the client side and send them to the server at one time.</p> <p><strong>2.</strong> When the user press the submit button call a js function to aggregate all the comments in a structure that you will be able to parse easily on the server side (ie. <code>"{c1,comment a};{c2,comment b};{c5=,comment e}..."</code>). pass that string to the server, parse it and update your model accordingly.</p> <p><strong>3.</strong> after each blur event in any of the comment fields, call a js function that updates an hidden field.</p> <pre><code>&lt;h:inputHidden value="{myClass.allComments}" /&gt; </code></pre> <p>when the user submits the form parse allComments and update your model accordingly.</p> <p><strong>EDIT:</strong></p> <p>To address the general performance issue I've added recommendations from an article that I found helpful <a href="http://www.jsfcentral.com/articles/speed_up_your_jsf_app_1.html" rel="noreferrer">speed up part 1</a> <a href="http://www.jsfcentral.com/articles/speed_up_your_jsf_app_2.html" rel="noreferrer">Speed up part 2</a>.</p> <p>Hope this helps</p> <p>btw, I would recommend the first approach rather than the last two.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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