Use Native Namespace instead of XHTML Namespace
ZK creates a component (one of the derives of AbstractTag) for each XML element specified with the XHTML component set. In other words, ZK will maintain their states at the server. However, if you won't change their states dynamically (i.e., after instantiated), you could use the native namespace instead.
For example, the following code snippet creates five components (one Table, Tr, Textbox and two Td).
<syntax lang="xml" > <h:table xmlns:h="xhtml">
<h:tr> <h:td>Name</h:td> <h:td> <textbox/> </h:td> </h:tr>
</h:table> </syntax>
On the other hand, the following code snippet won't create components for any elements specified with the native space (with prefix n:
)[1].
<syntax lang="xml" > <n:table xmlns:n="native">
<n:tr> <n:td>Name</n:td> <n:td> <textbox/> </n:td> </n:tr>
</n:table> </syntax>
Notice that table, tr and td are generated directly to the client, so they don't have no counterpart at the client either. You can not change their states dynamically. For example, the following code snippet is incorrect.
<syntax lang="xml" > <n:ul id="x" xmlns:n="native"/> <button label="add" onClick="new Li().setParent(x)"/> </syntax>
If you have to change them dynamically, you still have to use the XHTML component set, or you could use Html alternatively, if the HTML tags won't contain any ZUL component.
Version History
Version | Date | Content |
---|---|---|
- ↑ In fact, it will still creates some components for the rerender purpose, such as Component.invalidate(). However, since they shall not be accessed, you could image there are not created at all.