0

how to combine between xhtml and zul component

asked 2008-08-06 08:44:42 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai,

i need to combine xhml and zul component. but all component to generate by script not a static page.

i know how to create a zul component from a script like Button btn = new Button();

but how to create a xhtml ? or is there any diffrent ide

TIA,

andy susanto

delete flag offensive retag edit

9 Replies

Sort by ยป oldest newest

answered 2008-08-06 09:04:51 +0800

windperson gravatar image windperson
415 1

You may refer to this section in Developer Guide:
http://www.zkoss.org/doc/devguide/ch08s01s01.html

link publish delete flag offensive edit

answered 2008-08-06 09:25:11 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai,

i try like this

in zul file

<window xmlns:h="http://www.w3.org/1999/xhtml" id="massageinwindow" use="ibs.transaksi.spa.massage.MassageStop">


and in java file :
Button btn = new Button();
btn.setId(rs.getString("LOCKER_ID")); 
btn.setLabel(rs.getString("LOCKER_NO")); 
btn.setParent(win);
StringBuffer sb = new StringBuffer(); 
sb.append("<h:blink>").append("</h:blink>"); 
Executions.createComponentsDirectly(sb.toString(), null, btn, null); 


but when i click the page i get an error

Failed to load /forms/display/spa/massage/stop.zul

Cause: org.xml.sax.SAXParseException: The prefix "h" for element "h:blink" is not bound.
org.zkoss.zk.ui.UiException: org.xml.sax.SAXParseException: The prefix "h" for element "h:blink" is not bound.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.zkoss.lang.Classes.newInstance(Classes.java:78)
at org.zkoss.lang.Exceptions.wrap(Exceptions.java:164)
at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:46)
at org.zkoss.zk.ui.metainfo.PageDefinitions.getPageDefinitionDirectly(PageDefinitions.java:98)
at org.zkoss.zk.ui.metainfo.PageDefinitions.getPageDefinitionDirectly(PageDefinitions.java:71)
...

link publish delete flag offensive edit

answered 2008-08-06 10:18:02 +0800

windperson gravatar image windperson
415 1

Hi ibsolution,
If you want to output static page to browser side, there's a component called html:
http://www.zkoss.org/doc/devguide/ch07s17s01.html
but be sure to output a well-formed html segment in a single html zul tag element.

link publish delete flag offensive edit

answered 2008-08-06 13:37:19 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai windperson,

i am not want to output become a static page. i need dynamic page.

i try to combine between xhtml and zul component because i need to blink a button. i already create a javascript that can blink any component just to add <blink> tag in front the component. i do not have an issued if i am using a static page.

my problem is. I create a button from database data and i must blink the button if some condition is fullfil.

TIA,

andy susanto

link publish delete flag offensive edit

answered 2008-08-07 01:34:17 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

this string content in createComponentsDirectly() must be a 'actual' and 'stand along' xml content.
which means, if you use any namespace, then you must add namespace declaration, such as

sb.append("<h:blink xmlns:h=\"http://www.w3.org/1999/xhtml\">").append("</h:blink>");

link publish delete flag offensive edit

answered 2008-08-07 07:05:50 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai dennis,

dennis can you help me how to create a <h:blink> "button from zul" </h:blink>

when i try it but i get an error that button cannot have a child.


TIA,

andy susanto

link publish delete flag offensive edit

answered 2008-08-07 15:28:14 +0800

ibsolution gravatar image ibsolution
468 1 1 6

oke i solve it. i just change my javascript

but i still want to know how to add xhtml tag infront the zul component for an example
<h:xhtmltag> "component of zul" <h:xhtmltag>


TIA,

andy susanto

link publish delete flag offensive edit

answered 2008-08-08 06:38:18 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

Hi, I miss some thing, the code you have was wrong:

Button btn = new Button();
btn.setId(rs.getString("LOCKER_ID")); 
btn.setLabel(rs.getString("LOCKER_NO")); 
btn.setParent(win);
StringBuffer sb = new StringBuffer(); 
sb.append("<h:blink>").append("</h:blink>"); 
Executions.createComponentsDirectly(sb.toString(), null, btn, null); 

the logic is adverse,
the error is because Button doesn't accept any child, so you can not put ZUL Component or ZHTML Component in to it.

link publish delete flag offensive edit

answered 2008-08-08 06:44:52 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

Oops, Blink is not kind of ZHTML component. :(

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: 2008-08-06 08:44:42 +0800

Seen: 179 times

Last updated: Aug 08 '08

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