com.sun.rave.web.ui.component
Class ScriptBase

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended bycom.sun.rave.web.ui.component.ScriptBase
All Implemented Interfaces:
javax.faces.component.StateHolder
Direct Known Subclasses:
Script

public abstract class ScriptBase
extends javax.faces.component.UIComponentBase

Use the ui:script tag to create a <script> element in the rendered HTML page. The ui:script tag must be used within the ui:head tag, or within the ui:body tag.  The ui:script tag can be used to refer to a Javascript file, by using the url attribute. The tag can also be used embed Javascript code within the rendered HTML page.

The client-side script allows you to perform some interactive functions such as input checking before the page is submitted.

HTML Elements and Layout

The rendered HTML page contains a <script> element with any attributes specified through the ui:script tag attributes. 

Theme Identifiers

None.

Client Side Javascript Functions

None.

Example

Example 1: Create a script tag to a file

<ui:script url="/pathtomyjs/myjavascript.js" />

Example 2: Create a script tag with embedded script (Not Recommended)

<ui:script>
    <f:verbatim>
         function foo(text) {
             alert(text);
         }
    </f:verbatim>

</ui:script>


Note: If the embeded script includes characters like "<" or "&", the script code should be placed in an external file (see Example 1).

Auto-generated component class. Do NOT modify; all changes will be lost!


Constructor Summary
ScriptBase()
          Construct a new ScriptBase.
 
Method Summary
 java.lang.String getCharset()
          Defines the character (charset) encoding of the target URL.
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.String getType()
          Indicates the MIME type of the script.
 java.lang.String getUrl()
          Defines the absolute or relative URL to a file that contains the script.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setCharset(java.lang.String charset)
          Defines the character (charset) encoding of the target URL.
 void setType(java.lang.String type)
          Indicates the MIME type of the script.
 void setUrl(java.lang.String url)
          Defines the absolute or relative URL to a file that contains the script.
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptBase

public ScriptBase()

Construct a new ScriptBase.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.


getCharset

public java.lang.String getCharset()

Defines the character (charset) encoding of the target URL. See iana.org for a complete list of character encodings.


setCharset

public void setCharset(java.lang.String charset)

Defines the character (charset) encoding of the target URL. See iana.org for a complete list of character encodings.

See Also:
getCharset()

getType

public java.lang.String getType()

Indicates the MIME type of the script. Default is "text/javascript"


setType

public void setType(java.lang.String type)

Indicates the MIME type of the script. Default is "text/javascript"

See Also:
getType()

getUrl

public java.lang.String getUrl()

Defines the absolute or relative URL to a file that contains the script. Use this attribute to refer to a file instead of inserting the script into your HTML document


setUrl

public void setUrl(java.lang.String url)

Defines the absolute or relative URL to a file that contains the script. Use this attribute to refer to a file instead of inserting the script into your HTML document

See Also:
getUrl()

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)

Restore the state of this component.


saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)

Save the state of this component.