# sturcture zk

207 1 2

hi all
Can anybody let me know the project structure zk
where i put tld field, context.xml and the other filed
thx for help

delete retag edit

## 9 Replies

caclark
1753 2 5
http://clarktrips.intltwi...

There are a lot of sample projects in the small talks that you can use as guidelines.

Here are all the smalltalks: http://docs.zkoss.org/wiki/Small_Talks

207 1 2

i know this simple stucture
but i want a exemple of complexe stucture as i show (addon-language, tld field, etc)
thx for understand

SimonPai
1696 1

The correct deployment structure for each feature is documented by each provider of that feature. I'm afraid there's no one-shot guide that covers everything.
You have to search for user guide of each of the things you want to add into your application.

Regards,
Simon

207 1 2

thx
now i understand
there is not conventionnal structure for a project zk that contain all cases

robertpic71
1275 1

If you use Spring/JPA/Hibernate you can create a ZetaForm (new/other/zk/zeta). You'll get a full configured and running project including i.e. zk.xml.
I do not use the zeta-form, but i use it onetime (dummy) to setup my project.

After this, you could simple annotatie (@) your resources and use spring-injects, transactioncontroll....

Note: You need to edit the application-context.xml to add your packages for spring-injections.
i.e.
<zksp-annot:component-scan base-package="org.zkoss.spring.jpa,your.root.package"/>

/Robert

207 1 2

hi Robert
this is what we call a a excellent answer
but tell me how i can get this ZetaForm
thx againnn

robertpic71
1275 1

Hi,

ZetaForms are a part of the ZK Studio for Eclipse (there is also a tool for Netbeans).

1) Setup Eclipse
Install Java JDK
Install Tomcat
Configure Tomcat inside Eclipse

2.) Setup ZK Studio

If you only need a new ZK Project - create new Projekt ZK (but you have to configure Spring yourself).

3a) Database
Configure your database inside the "Data Source Explorer" - check this example for MySQL.
Note you need a JDBC-Driver for correct setup.

Check this and this.

Now you have an simple CRUD for one table and is Spring/JPA/Hibernate/ZK is ready.

Here some simple Spring examples:

Annotate your controllers like this: (make sure that your package is inside the scan-path from the application-context.xml)

@Repository("mainController")
@Scope("prototype")
public class Main extends GenericForwardComposer {

and use it in your zul like that:

..
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
...
<window id="win" border="normal" apply="\${mainController}" width="970px">


Your controller is now Spring managed, you can scope your resources as singleton (i.e. a list of logged users, configs, ServiceLayer) or session (i.e. userdata after login) or inject JDBC-connections, hibernate session or better JPA transactions.

/Robert

207 1 2

hi robert
thx so much for your time

207 1 2

hi robert
i want ask there is a tutorial to how i configure spring
thx again

[hide preview]