0

Dynamically writing <h:> xhtml to a zul page

asked 2006-03-13 16:15:52 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627008

By: jim_bo_lisa

Is it possible to dynamically write out <h:> xhtml tags to a zul extension page from the java server code?

I currently have a zul file with a window that I added:

xmlns:h="http://www.w3.org/1999/xhtml"

to handle xhtml. From this window a query is performed, when the results come back I want to output XHTML tags like <table> to the zul window. I am thinking I need to write it out as <h:table>. I think this should work, the only problem I see now is that the appendChild() method on the component only handles argumenets of type Component and I do not see a component for the <h:> xhtml tags.

Let me know if I am close or a better way to do this.

thanks

delete flag offensive retag edit

9 Replies

Sort by » oldest newest

answered 2006-03-13 16:27:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627031

By: tomyeh

Uses Executions.createComponentDirectly.

link publish delete flag offensive edit

answered 2006-03-13 17:50:42 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627175

By: jim_bo_lisa

I added in the createComponentsDirectly() call and am now receiving Exception:


12:50:15,604 INFO [STDOUT] 10 Mar 13, 2006 12:50:15 PM com.potix.idom.input.SAX Handler fatalError:740
SEVERE: The prefix "h" for element "h:table" is not bound.[line 1 col 21]
12:50:15,604 INFO [STDOUT] 11 Mar 13, 2006 12:50:15 PM com.potix.zk.ui.sys.UiEn gineImpl handleError:441
SEVERE: >>com.potix.zk.ui.UiException: org.xml.sax.SAXParseException: The prefix "h" for element "h:table" is not bound.
>>org.xml.sax.SAXParseException: The prefix "h" for element "h:table" is
>>not
bou
nd.
>> at
>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
>> at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown
Source)

>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>> at
>> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
>> at
>> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
canRootElementHook(Unknown Source)
>> at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
>> at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>> at javax.xml.parsers.SAXParser.parse(Unknown Source)
>> at com.potix.idom.input.SAXBuilder.build(SAXBuilder.java:340)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:105)
>> at
>> com.potix.zk.ui.http.Definitions.getPageDefinitionDirectly(Definition
s.java:89)
>> at
>> com.potix.zk.ui.http.Definitions.getPageDefinitionDirectly(Definition
s.java:70)
>> at
>> com.potix.zk.ui.http.ServletExecution.getPageDefinitionDirectly(Servl
etExecution.java:162)
>> at
>> com.potix.zk.ui.sys.AbstractExecution.createComponentsDirectly(Abstra
ctExecution.java:185)
>> at
>> com.potix.zk.ui.Executions.createComponentsDirectly(Executions.java:1
25)
>> at
>> condenserii.webtier.zkextensions.SummaryPanel.createSummaryPanel(Summ
aryPanel.java:86)



Tabpanel tp = new Tabpanel();
StringBuffer sb = new StringBuffer();
sb.append("<h:table>"); sb.append("<h:tr>"); sb.append("<h:td>"); sb.append("
<h:td>"); sb.append("<h:tr>"); sb.append("</h:table>"); Executions.createComp
onentsDirectly(sb.toString(), null, tp, null);


link publish delete flag offensive edit

answered 2006-03-13 17:55:08 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627195

By: nobody

What is passed to createComponentDirectly must be valid XML. In your case you have to specify XML name space for h.

link publish delete flag offensive edit

answered 2006-03-13 18:08:11 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627247

By: jim_bo_lisa

How to set this?
Is that the extension parameter of the createComponentsDirectly() method? So i would use zhtml for the extension like the following:

Executions.createComponentsDirectly(sb.toString(), "zhtml", tp, null);

I have the window to which I am writing set to have:

<window id="_querySummaryWin" border="normal" height="550px" width="700px"
xmlns:h="http://www.w3.org/1999/xhtml">

link publish delete flag offensive edit

answered 2006-03-13 19:53:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627429

By: jim_bo_lisa

Would it be better to output my HTML table to a new *.html file then have the zul window include this file using the <include> tag.

I am still having problems with setting the namespace so I am thinking of workarounds.

thanks.

link publish delete flag offensive edit

answered 2006-03-14 01:14:01 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627949

By: tomyeh

If use use "zhtml" (or "html" or "xhtml") as the extension, ZK looks for XHTML component sets if no name space is specified.
Thus, you could use
<table><tr>....

On the other hand, if you want to use XUL component set, you have to specify name space:

<table><tr><td><x:window
xmlns:x="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
...

If you don't specify the extension, the default extension is "xul". And:

<h:table xmlns:h="http://www.w3.org/1999/xhtml">
<h:tr><h:td><window>...

Take one more look at ZUML and Name Space in the Developer's Guide.

link publish delete flag offensive edit

answered 2006-03-14 01:16:06 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3627957

By: tomyeh

I don't think output to a file could solve the problem, because the mechanism is the same. In additions, the peformance is worse, and you have to clean it up.

link publish delete flag offensive edit

answered 2006-03-14 21:47:10 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3629805

By: jim_bo_lisa

<h:table xmlns:h="http://www.w3.org/1999/xhtml">

Ahhh, this answered my question. I had no idea where to specify the Namespace/extension when calling the createComponentsDirectly method in my serverside Java code.

link publish delete flag offensive edit

answered 2006-03-28 13:59:59 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3655028

By: rfrps

IA’m trying to custom the ListitemRenderer without success.

3 28/03/2006 10:44:47 com.potix.zk.ui.sys.UiEngineImpl handleError:472
SEVERE: >>java.lang.ClassCastException: class java.lang.String cannot be converted to interface com.potix.zul.html.ListitemRenderer.
>>java.lang.InstantiationException: com.potix.zul.html.ListitemRenderer
>> at java.lang.Class.newInstance0(Unknown Source)
>> at java.lang.Class.newInstance(Unknown Source)
>> at com.potix.lang.Classes.coerce(Classes.java:1227)
>> at
>>com.potix.zk.ui.metainfo.InstanceDefinition$MemberInfo.<init>(Instance
>>Defi
nition.java:386)
>> at
>>com.potix.zk.ui.metainfo.InstanceDefinition$MemberInfo.<init>(Instance
>>Defi
nition.java:336)
>> at
>>com.potix.zk.ui.metainfo.InstanceDefinition.addMember(InstanceDefiniti
>>on.j
ava:165)
>> at com.potix.zk.ui.sys.AbstractParser.addAttribute(AbstractParser.java:365)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:323)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:223)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:328)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:198)
>> at com.potix.zk.ui.sys.AbstractParser.parse(AbstractParser.java:105)
>> at
>>com.potix.zk.ui.http.Definitions.getPageDefinitionDirectly(Definitions
>>.jav
a:89)
>> at
>>com.potix.zk.ui.http.Definitions.getPageDefinitionDirectly(Definitions
>>.jav
a:70)
>> at
>>com.potix.zk.ui.http.ServletExecution.getPageDefinitionDirectly(Servle
>>tExe
cution.java:175)
>> at
>>com.potix.zk.ui.sys.AbstractExecution.createComponentsDirectly(Abstrac
>>tExe
cution.java:193)
>> at com.potix.zk.ui.Executions.createComponentsDirectly(Executions.java:125)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at bsh.Reflect.invokeMethod(Unknown Source)
>> at bsh.Reflect.invokeStaticMethod(Unknown Source)
>> at bsh.Name.invokeMethod(Unknown Source)
>> at bsh.BSHMethodInvocation.eval(Unknown Source)
>> at bsh.BSHPrimaryExpression.eval(Unknown Source)
>> at bsh.BSHPrimaryExpression.eval(Unknown Source)
>> at bsh.BSHBlock.evalBlock(Unknown Source)
>> at bsh.BSHBlock.eval(Unknown Source)
>> at bsh.BshMethod.invokeImpl(Unknown Source)
>> at bsh.BshMethod.invoke(Unknown Source)
>> at bsh.BshMethod.invoke(Unknown Source)
>> at bsh.Name.invokeLocalMethod(Unknown Source)
>> at bsh.Name.invokeMethod(Unknown Source)
>> at bsh.BSHMethodInvocation.eval(Unknown Source)
>> at bsh.BSHPrimaryExpression.eval(Unknown Source)
>> at bsh.BSHPrimaryExpression.eval(Unknown Source)
>> at bsh.Interpreter.eval(Unknown Source)
>> at bsh.Interpreter.eval(Unknown Source)
>> at com.potix.zk.ui.sys.PageImpl.interpret(PageImpl.java:405)
>> at
>>com.potix.zk.ui.sys.EventProcessingThread.process0(EventProcessingThre
>>ad.j
ava:370)
>> at
>>com.potix.zk.ui.sys.EventProcessingThread.run(EventProcessingThread.ja
>>va:2
85)


Look my codes:

livedata.zul
<window title="Livedata Demo" border="normal">
<label id="show"/>
<zscript>
String[] data = new String[30];
for(int j=0; j < data.length; ++j) {
data[j] = "option "+j+" ["+j+"]";
}
ListModel strset = new SimpleListModel(data);
</zscript>
<listbox id="list" width="200px" rows="10" model="${strset}"
onSelect="show.value=self.selectedItem.value;"
itemRenderer="suportsys.zul.html.ValeuListitemRenderer">
<listhead>
<listheader label="Load on Demend"/>
</listhead>
</listbox>
</window>


ValueListitemRenderer.java
// ValueListitemRenderer.java

package suportsys.zul.html;

import com.potix.zul.html.*;

public class ValueListitemRenderer implements ListitemRenderer{

public void render(Listitem item, Object data) throws Exception {
String label = data.toString();
String value = label;
int start = label.indexOf("[");
if (start>2) {
int end = label.indexOf("]");
if (end>start) {
label = label.substring(start-1);
value = label.substring(start+1,end-start-1);
}
}
item.setLabel(label);
item.setValue(value);
}
}


when data.toString() == "California [CA]", then item.setLabel("California") and item.setValue("CA")

WhatA’s wrong?
Help me, please!


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-03-13 16:15:52 +0800

Seen: 511 times

Last updated: Mar 28 '06

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More