0

I am wondering about f:event location and sub tags; I googled a lot but couldn't find f:event to be used with its body subtags something like this (see code snippet) :

<f:event type="postAddToView"...>
<c:set var="myVar" value="#{aBean.aProperty}">    
</f:event>

...so to call bean after DOM loaded or similar? I mean how to use f:event exactly to init c:set after DOM is loaded? And is it possible to catch the event with JSF?

Thanks

toby
  • 1
  • 1
  • You seem to be looking for a solution in a certain direction while I think you problem is more generic in nature: https://stackoverflow.com/questions/16588327/how-to-invoke-a-jsf-managed-bean-on-a-html-dom-event-using-native-javascript – Kukeltje May 22 '17 at 18:40
  • No, I am looking for on-dom-loaded-event-catch-on-jsf optimal solution. Something like the javascript's `document.addEventListener('DOMContentLoaded', function() { }, false);` solution is – toby May 22 '17 at 20:18
  • Yes and if you read the 'duplicate' good enough, that is exactly what you can achieve... – Kukeltje May 22 '17 at 20:29
  • @Kukeltje the solution describes a 'hack' way but is there a standard one? – toby May 23 '17 at 15:05
  • 1 is a hack, 2, 3 and 4 are the normal solutions. Of which 4 is standardized and 2 and 3 are its predecessors. – Kukeltje May 23 '17 at 15:26
  • @Kukeltje Currently I am using JSF itself not it's based libs so is there a standard way for JSF? – toby May 23 '17 at 17:06
  • Number 4... (but including omnifaces is always good) – Kukeltje May 23 '17 at 17:21
  • @Kukeltje but I asked about the f:event body; So will (see question) c:set be exec-ed on to the `postAddToView` event for example? – toby May 24 '17 at 15:47
  • Yes, but that is all server side... all before any html is sent to the client, so no relation at all to any client-side dom events. That's why I stated you most likely have an xy problem and I focussed on the dom part and then the `f:event` does not play any role. As long as your functional requirement is not clarified, the answer to _"...so to call bean after DOM loaded or similar?"_ is what I stated – Kukeltje May 24 '17 at 16:27

0 Answers0