How would I call a JavaScript function from a JSF Bean? -


i need java code, trying following, got stuck:

    uioutput js = new uioutput();     js.setrenderertype("javax.faces.resource.script");     js.getattributes().put("library", "js");     js.setvalue("alert(123);");      facescontext context = facescontext.getcurrentinstance();     context.getviewroot().addcomponentresource(context, js, "body"); 

i didn't error in server log, didn't see alert.

any idea?

edit: tried suggested solution, alleged duplicate, , didn't server error either, neither did see alert..

i'm assuming want jsf managedbean, not jsf component.

i'm not sure there 'plain' jsf solution (meaning not adding framework or creating , maintaining specific java code).

there @ least 2 solutions (the ones worked with):

i'm sure other component suites (richfaces, icefaces, openfaces, ...) have similar solution.

if want stay using plain jsf, i'd go using omnifaces. it's great addition in general , prevents maintaining knowledge implementation specifics.

edit: found plain jsf solution


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -