org.icefaces.ace.util

## Class ScriptWriter

- java.lang.Object
- - org.icefaces.ace.util.ScriptWriter

-     public class ScriptWriter
      extends java.lang.Object

  A utility class used to easily insert a script element into the markup. It allows the writing of the script in one call or writing it out gradually.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScriptWriter(javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endScript()`
    `static ScriptWriter` | `insertScript(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Write the script markup and then gradually write the script code by calling the 'write' write methods on the ScriptWriter instance.
    `static void` | `insertScript(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String script)` Write script markup and script code in one method call.
    `static void` | `insertScript(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String script, java.lang.String id)` Write script markup and script code in one method call.
    `void` | `startScript()`
    `void` | `write(boolean val)`
    `void` | `write(char val)`
    `void` | `write(double val)`
    `void` | `write(float val)`
    `void` | `write(int val)`
    `void` | `write(long val)`
    `void` | `write(java.lang.Object val)`
    `void` | `write(java.lang.String val)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ScriptWriter

          public ScriptWriter(javax.faces.context.ResponseWriter writer,
                              javax.faces.component.UIComponent component)

  - ### Method Detail

    - #### insertScript

          public static void insertScript(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          java.lang.String script)
                                   throws java.io.IOException

      Write script markup and script code in one method call.
      Parameters:
        `context` - the curent FacesContext
        `component` - the component making the call
        `script` - the code
      Throws:
        `java.io.IOException`

    - #### insertScript

          public static void insertScript(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          java.lang.String script,
                                          java.lang.String id)
                                   throws java.io.IOException

      Write script markup and script code in one method call.
      Parameters:
        `context` - the curent FacesContext
        `component` - the component making the call
        `script` - the code
        `id` - the id of the rendered span
      Throws:
        `java.io.IOException`

    - #### insertScript

          public static ScriptWriter insertScript(javax.faces.context.FacesContext context,
                                                  javax.faces.component.UIComponent component)
                                           throws java.io.IOException

      Write the script markup and then gradually write the script code by calling the 'write' write methods on the ScriptWriter instance.
      Parameters:
        `context` - the curent FacesContext
        `component` - the component making the call
      Returns:
        ScriptWriter instance used for streaming the code
      Throws:
        `java.io.IOException`

    - #### startScript

          public void startScript()
                           throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(java.lang.String val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(int val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(long val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(double val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(float val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(boolean val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(char val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public void write(java.lang.Object val)
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### endScript

          public void endScript()
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.