title: call javascript from managed bean
body: <p>I want to clear form hidden value in JSF page from managedbean class .so i used to call a method in that i used this code to call javascript but it throws java.lang.NullPointerException below is the code.</p>
  
  <pre><code>FacesContext facesContext = FacesContext.getCurrentInstance();
      ExtendedRenderKitService service = 
                Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
              service.addScript(facesContext, "alert('foo');");
  </code></pre>
  
  <p>the error is thrown in the line where alert is called .can someone help me please.even i tried to call a function in JSF page to reset values...it gave me same error.</p>