Communicate with included html (events, setting values)

asked 2021-02-25 20:15:05 +0800

assonaZkDev004 gravatar image assonaZkDev004
101 2

Hi :-)

I included a static html page in a zul file (see code). Now I want to retrieve events (button click on "#button1") from inside the html-page back to ZK (via Composer) and setting some text back into the html (input "#testbox"). Is that possible?


<window id="htmlwindow" apply="de.assona.jive.jnh.HtmlPageComposer">
    <textbox id="targetBox" name="targetBox" value="" width="150px" />


    <div align="center">
    <p>html page</p>    
    <button id="button1" value="Val01" >Click me</button>   
    <input id="testbox" type="text">


public class HtmlPageComposer extends SelectorComposer<Component> {

    // wire components
    private Window htmlwindow;

    public void doAfterCompose(final Component comp) throws Exception {

    Include htmlinclude = new Include();

Thank you

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-26 14:37:21 +0800

cor3000 gravatar image cor3000
6280 2 7

YES that's possible: see this example


I avoided the Include component since it switches to "defer" in this case making things slightly more complicated (unnecessary for your case). Instead I use an Idspace component avoiding ID clashes with other components. and create the components directly from HTML. Be aware that this creates a ZK component for each HTML element (using the XHTML component set, so you'll need the zhtml.jar dependency).

If you need something more memory efficient, consider combining native elements with xhtml components. (For smaller included html fragments this shouldn't matter.)

See here for a comparison of different namespaces.

link publish delete flag offensive edit


Thank you VERY much, that is a nice and elegant solution! And also thank you for the hints of memory efficiency!

assonaZkDev004 ( 2021-02-26 15:43:04 +0800 )edit
Your answer
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

1 follower



Asked: 2021-02-25 20:15:05 +0800

Seen: 9 times

Last updated: Feb 26 '21

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