Frage

anyone know how to load a Zul from a Jar? I have a library project wich contains Zul. currently i use createComponents(String uri, Component parent, Map arg) but i don't know or can't reference a uri in a jar.


I use now:

public static Component createComponentsFromJar(final String path, final Component parent, final Map<?,?> arg) throws IOException {
    final InputStream resourceAsStream = ComponentHelper.class.getClassLoader().getResourceAsStream(path);
    final PageDefinition pageDefinition = Executions.getCurrent().getPageDefinitionDirectly(new InputStreamReader(resourceAsStream), "zul");
    resourceAsStream.close();
    return Executions.createComponents(pageDefinition, parent, arg);
}

does any know some problems with this method of creating new pages? Some binding problems or someting?

War es hilfreich?

Lösung

Executions.createComponents will work with ZK Specific URI (refer to Inter-Application Communication) where "~./" in ZK Specific URI will get the file under "classpath/web/", assume your zul page under "src/web/zul/pages" as below:

zul page under src

And you export the src folder as a jar, then you can create component with the zul file in jar as below:

Executions.createComponents("~./zul/pages/zulInJar.zul", parent, null);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top