@Override public void endElement(String name) throws IOException { if (StringPool.BODY.equals(name)) { super.startElement(StringPool.SCRIPT, uiComponent); super.writeAttribute(StringPool.TYPE, ContentTypes.TEXT_JAVASCRIPT, null); FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); ClientScriptFactory clientScriptFactory = (ClientScriptFactory) FactoryExtensionFinder.getFactory(ClientScriptFactory.class); ClientScript clientScript = clientScriptFactory.getClientScript(externalContext); super.write(clientScript.toString()); super.endElement(StringPool.SCRIPT); } super.endElement(name); }
@Override public void startElement(String name, UIComponent uiComponent) throws IOException { this.uiComponent = uiComponent; super.startElement(name, uiComponent); }