title: EL expression inside p:commandButton onclick does not update/re-render on ajax request?
body: <p>The <code>onclick</code> attribute of my <code>commandButton</code> has some EL dependent Javascript inside. To be more specific, here is that piece of code:</p>
  
  <pre><code>&lt;p:commandButton
      onclick="javascript: if('#{userBean.user.friendList.size() gt 0}' == 'true') deleteFriendsConfirmDialog.show(); else friendsAlreadyDeletedErrorDialog.show();"
      value="Delete all friends?" /&gt;
  </code></pre>
  
  <p><code>deleteFriendsConfirmDialog</code> clears the list of friends and updates the <code>@form</code>. The list of friends, commandButton and the dialogs are all in that form.</p>
  
  <p>So I click the button, confirmation dialog comes up (because the length of friends' list is gt 0), I confirm and the list is emptied, the view is updated. However, when I click the <code>Delete all friends?</code> button once more, the confirmation dialog comes up again. Since the length of the list is now 0, I instead expect the error dialog to show.</p>
  
  <p>That, I guess, is because the Javascript written inside <code>onclick</code> is not updated (although the button is in the form).</p>
  
  <p><strong>Edit:</strong> Changing <code>#{userBean.user.friendList.size() gt 0}</code> to <code>#{not empty userBean.user.friendList}</code> doesn't work neither.</p>
  
  <p>How come? What's wrong here?</p>
  
  <p>Any help appreciated. :)</p>