All Downloads are FREE. Search and download functionalities are using the official Maven repository.

facesdoc.HTML_BASIC.javax.faces.Outputjavax.faces.resource.Script.html Maven / Gradle / Ivy

Go to download

This is the master POM file for Oracle's Implementation of the JSF 2.3 Specification.

There is a newer version: 2.3-pfd
Show newest version




<font size="-1">component-family:</font> javax.faces.Output <font size="-1">renderer-type:</font> javax.faces.resource.Script






HTML_BASIC render-kit
component-family: javax.faces.Output renderer-type: javax.faces.resource.Script


Render the markup for a <script> element that renders the script Resource specified by the optional name attribute and library attributes.

The implementation of this renderer must have a @ListenerFor annotation attached to it, at the class level, declaring PostAddToViewEvent.class as the value of the systemEventClass attribute. The presence of this annotation on a renderer implies the renderer implements ComponentSystemEventListener, which this renderer must do. The implementation of processEvent() must extract the UIComponent from the argument event and look for the presence of the key "target" in the component's attribute Map. If and only if such a key is present, the implementation of processEvent() must pass the component to UIViewRoot.addComponentResource().

Decode Behavior

    No action is required during decode for this renderer.

Encode Behavior

    Common Algorithm for Obtaining A Resource to Render

      This algorithm is used by all resource renderers to obtain a Resource instance which is then rendered in a specific way depending on what kind of renderer is doing the encoding.

      • Look in the component attribute Map for a value under the key name.

      • Look in the component attribute Map for a value under the key library. This attribute is optional, therefore, library may be null.

      • Create the resource by calling Application.getResourceHandler.createResource(name, library);.

    Common Encode Behavior

      This algorithm is used by all resource renderers to render the resource.

      encodeBegin() must take no action.

      Because this renderer returns true from getRendersChildren(), the encodeChildren() method must take the following action.

      • If there is no name attribute, and the argument component has no children, and ProjectStage is not ProjectStage.Production, add a FacesMessage for this component's clientId to the FacesContext stating that if no name attribute is present, and no body content is present either, then the user should take action to correct this problem. In this case, encodeChildren() must take no further action.

      • If there is no name attribute and the argument component does have children, the renderer must ensure that those children are encoded as usual.

      • If there is a name attribute and the argument component does have children, the renderer must log a descriptive localized message stating that the child content will be ignored. The resource referenced by the name attribute will be rendered in encodeEnd().

      • If there is a name attribute and the argument component does not have children, encodeChildren() must take no action.

      encodeEnd() must take specific action based on the specific kind of resource being rendered.

    Use the algorithm Common Encode Behavior for encodeBegin(), encodeChildren() and getRendersChildren().

    For encodeEnd(), use the algorithm Common Algorithm for Obtaining A Resource to Render above to obtain a reference to the Resource to be encoded.

    If this is NOT the first time this Resource has been referenced on this request take no action and return.

    Render a script element. Call resource.getRequestPath(). If the result contains a query string, take care to handle it correctly. Pass the request path to a call to encodeResourceURL() on the ExternalContext. Use the result as the value of the "src" attribute. Use the result from calling resource.getContentType() as the value of the "type" attribute.

This renderer is responsible for rendering its children.


Note:

Attributes with a pass-through value of true are not interpreted by the renderer and are passed straight through to the rendered markup, without checking for validity. Attributes with a pass-through value of false are interpreted by the renderer, and may or may not be checked for validity by the renderer.

Attributes
attribute-name pass-through attribute-class description default-value
 library false java.lang.String

The libraryName for this resource.

undefined
 name false java.lang.String

The resourceName for this resource.

This attribute is required

undefined
 target false java.lang.String

The target area for which this resource will be rendered. For example, target="head" would cause the resource to be rendered within the head element. If no value is specififed, the script element is rendered at the same point in the view where the tag is located. Currently supported values for this attribute are "head", "body", and "form".

undefined

Copyright (c) 2003-2010 Oracle America, Inc. All Rights Reserved.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy