Class Html

  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Html
All Implemented Interfaces:, java.lang.Cloneable, Component, Scope, ComponentCtrl

public class Html
extends XulElement

A component used to embed the browser native content (i.e., HTML tags) into the output sent to the browser. The browser native content is specified by setContent(java.lang.String).

Notice that Html generates HTML SPAN to enclose the embedded HTML tags. Thus, you can specify the style (HtmlBasedComponent.getStyle()), tooltip XulElement.getTooltip() and so on.

<html style="border: 1px solid blue"><![CDATA[
  <li>It is in a SPAN tag.</li>

The generated HTML tags will look like:

<SPAN id="xxx" style="border: 1px solid blue">
  <li>It is in a SPAN tag.</li>

Since SPAN is used to enclosed the embedded HTML tags, so the following is incorrect.

   <td> <-- Incomplete since it is inside SPAN -->



If you need to generate the HTML tags directly without enclosing with SPAN, you can use the Native namespace, Refer to ZK Developer's Reference for more information.

A non-XUL extension.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
Fields inherited from interface org.zkoss.zk.ui.Component
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
Constructor Summary
          Constructs a Html component to embed HTML tags.
Html(java.lang.String content)
          Constructs a Html component to embed HTML tags with the specified content.
Method Summary
 java.lang.String getContent()
          Returns the embedded content (i.e., HTML tags).
protected  boolean isChildable()
          Default: not childable.
protected  void renderProperties(ContentRenderer renderer)
          Renders the content of this component, excluding the enclosing tags and children.
 void setContent(java.lang.String content)
          Sets the embedded content (i.e., HTML tags).
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public Html()
Constructs a Html component to embed HTML tags.


public Html(java.lang.String content)
Constructs a Html component to embed HTML tags with the specified content.

Method Detail


public java.lang.String getContent()
Returns the embedded content (i.e., HTML tags).


public void setContent(java.lang.String content)
Sets the embedded content (i.e., HTML tags).

Default: empty ("").

Deriving class can override it to return whatever it wants other than null.

Security Note

Unlike other methods, the content assigned to this method is generated directly to the browser without escaping. Thus, it is better not to have something input by the user to avoid any XSS attach.


protected void renderProperties(ContentRenderer renderer)
Description copied from class: HtmlBasedComponent
Renders the content of this component, excluding the enclosing tags and children.

See also ZK Client-side Reference: Property Rendering

renderProperties in class XulElement


protected boolean isChildable()
Default: not childable.

isChildable in class AbstractComponent

Copyright © 2005-2011 Potix Corporation. All Rights Reserved. Logo