-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm writing an application and I am using 100% java. This approach is appealing to me for a number of reasons, not the least of which because I've been told that using more java and less script should improve performance.
Well, I'm getting the hang of it, but I can't say I like it all that much. It is much more tedious to build a layout in Java vs. zul (Tabpanels, Box components, etc.). No big news here. I've reached the point where I'll mock something up in a zul file and then write it again in java. This got me thinking - I wonder how ZK, internally, processes markup prior to running the app? Is there a point where a .zul file is translated and compiled into a concrete Java class? If this is the case, I'm wondering how this might be useful to me to create some kind of tool that would output a .java class when I provide a .zul file?
Anyone have any thoughts on this?
Thanks,
Mike
@mklaene
Hi mklaene, our zul page will just build a dom tree, it won't be parsed to a java class, it's not the structure that zk did.
If you want to use more java to build a dom tree, you can write a composer and use lot of setParent() to instead declared tags in zul file.
/Joy
Thanks for the reply. I figured that was how it was done. I've used a composer in the past. I'm still trying to find the right balance. I have lots of dynamic activity on the site which is suited to java. I reasoned that it was better to be consistent and do the entire site in java. I may go back to a combination of the two. We'll see. Thanks.
mklaene, I think you misunderstood someone that said "that using more java and less script should improve performance". I think they were talking specifically about <zscript> blocks and not ZUL layout. From what I can tell, when a ZUL file is processed, it is cached and reused until it changes again; much like a JSP. I don't believe you'll see significant speed improvement from users 2 - n. Plus, doing it *all* in Java is a huge pain in the butt. I can't imagine the development cycle being fast at all.
This is from my experience. I'm interested in what others have to share.
In my case it's like in the real world. The golden middle way works for me at best.
It's like caClark said. It's a huge pain to do all comonents created in Java.
I put the main components in the zul-file. All other logic is in the java controllers.
So i try to hold my zul files small. One zul-file=one controller.
If i have several tabs, i have several zul.files for it and several controllers.
Only needed dynamically components are created in the code.
best
Stephan
Thanks for the feedback. I do believe I will go back to a more hybrid approach to doing things... It is just too tedious to try and do everything with java. I do think that pure Java development could be made a little more 'pleasant' with some helper classes/methods. Even though this article has been out a while, regarding MVC, I just came upon it yesterday : http://www.zkoss.org/smalltalks/mvc3/ It looks very useful and I will try to incorporate it into my app.
Mike
Asked: 2010-01-14 17:28:11 +0800
Seen: 600 times
Last updated: Jan 16 '10