简体   繁体   English

从Jar中加载ZUL

[英]Load ZUL from Jar

anyone know how to load a Zul from a Jar? 有人知道如何从Jar中加载祖尔吗? I have a library project wich contains Zul. 我有一个包含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. 目前,我使用createComponents(String uri,Component parent,Map arg),但我不知道或无法在jar中引用一个uri。


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? 一些绑定问题或问题?

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: Executions.createComponents将与ZK特定URI(请参阅应用程序间通信 )一起使用,其中ZK特定URI中的“〜。/ ”将在“ classpath / web /下获取文件 ,假设您的zul页面位于“ src / web / zul”下/ pages”,如下所示:

src下的zul页面

And you export the src folder as a jar, then you can create component with the zul file in jar as below: 然后将src文件夹导出为jar,然后可以使用jar中的zul文件创建组件,如下所示:

Executions.createComponents("~./zul/pages/zulInJar.zul", parent, null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM