gpt4 book ai didi

java - zk 框架 : zul file, 纯 java 或混合以获得更好的性能

转载 作者:行者123 更新时间:2023-12-04 05:11:38 26 4
gpt4 key购买 nike

zk 框架对于 Web 开发人员来说非常灵活。但是灵活性也带来了一些问题。我想知道哪种方法最能提高性能(内存、时间等)?

1) .zul 文件,包含以下脚本:

<vbox>
Auto-complete Combobox:
<combobox id="combo" autodrop="true" mold="rounded"/>
<hbox>
<checkbox checked="true"
onCheck="combo.autodrop = self.checked"
label="auto drop popup when typing" />
<checkbox checked="true"
onCheck="combo.buttonVisible = self.checked" label="button visible" />
</hbox>
<checkbox label="Use rounded combobox" checked="true"
onCheck='combo.mold=self.checked? "rounded": "default"'/>
</vbox>
<zscript>
String[] _dict = {
"abacus", "accuracy", "acuity", "adage", "afar", "after", "apple",
"bible", "bird", "bingle", "blog"
...

2)纯java喜欢
public class TestRenderer {

ListModelList model = new ListModelList();
private AnnotateDataBinder binder;

@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
binder = new AnnotateDataBinder(view);
List persons = new ArrayList();
model.add(new Person("David", "Coverdale"));
...

3)混合zk
<window apply="com.synnex.wms.outbound.so.IndexViewCtrl">
<style>
.z-row-cnt .z-label {
white-space:nowrap;
}
</style>
<grid model="${model}" rowRenderer="${renderer }" height="300px" width="800px">
<custom-attributes org.zkoss.zul.grid.rod="true" />
<custom-attributes org.zkoss.zul.grid.initRodSize="20" />
<columns>
<column forEach="${headers}" label="${each}" width="80px"/>
</columns>

</grid>


</window>

与 Spring 等不同技术一起使用时,它们是否有所不同? java到html的解析速度是否比zul到html的解析速度快?

最佳答案

Also notice that the evaluation of EL expressions is very fast, so EL can be used in a production system. On the other hand, zscript is suggested to use only in prototyping or quick-fix.
Link



所以不要使用 1)
2) 可以更快、更慢或一样快 3) 取决于您的实现,
但要更快可能需要很多时间,所以 2) 不是一个好主意。
3) 通常是最好的,因为 zul 文件比 java 代码更易读
并且 GUI 逻辑和 GUI 结构并没有(那么多)混淆。

要在 MVC 和 MVVM 之间进行选择,请阅读 this .
如果你认为混合它们有意义,那么框架应该没有问题。

关于java - zk 框架 : zul file, 纯 java 或混合以获得更好的性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14861645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com