new Zksample2 app. Spring, -AOP, -Security, Hibernate, Hibernate-Generic-DAO, Jasper

asked 2010-01-17 08:29:28 +0800

terrytornado gravatar image terrytornado flag of Germany
9373 3 7 16

updated 2013-03-27 08:56:18 +0800

jimyeh gravatar image jimyeh
2047 1 4
ZK Team

Hi all,

today we have checked in the new Zksample2 application as maven2 projects on sourceforge.net. You can reach the project homepage under the link http://zksample2.sourceforge.net/ here.

You will find there 3 eclipse maven subprojects and the folder for the documentation.

  1. KeyGenZkoss = one-time-password generator
  2. spring-hibernate-backend = backend
  3. zkoss = frontend
  4. zksample2_doc = documentation

The Documentation you can download seperately as a pdf-file from here.

The documentation is a work in progress so be sure to check sometimes for the newest file.

For checkout and evaluate or work with the application please download and read first the documentation.

Mainly changes to the first sample app are: - change project structure as maven2 projects - spring managed frontend - @Secured() for securing methods with own implementation - login statistic - several integration options of ipToCountry - one-time-password sources are opend - Refactoring all Domain/DAO/Service Classes to english names - many many code changes - documentation

We whish all fun with it and hope that it can be usefull for others.

best Stephan and Björn

delete flag offensive retag edit

213 Replies

Sort by » oldest newest

answered 2010-01-17 19:27:28 +0800

wanlim0817 gravatar image wanlim0817


congratulations and thanks for your great work.
I'm watting your new version for a long time.Now I'm so exciting to check out your new version of Zksample2.

PS:I'm the first one who give a reply for you, hahahaha:)

link publish delete flag offensive edit

answered 2010-01-18 02:54:37 +0800

kaiak gravatar image kaiak

congratulations !

what great work you have done!

link publish delete flag offensive edit

answered 2010-01-19 13:38:34 +0800

GuzZpaWn gravatar image GuzZpaWn
111 2

when a go to http://zksample2.sourceforge.net/ and click on Download files it sends me to
Error 404 We apologize. The page you were looking for cannot be found. You may want to try one of the options listed below.

link publish delete flag offensive edit

answered 2010-01-19 16:49:47 +0800

terrytornado gravatar image terrytornado flag of Germany
9373 3 7 16

updated 2010-01-20 12:53:10 +0800

Hmmmmmmmmm, you are right. Yesterday this is working well.???
Seems the project ID's are lost ???

Go to http://sourceforge.net/projects/zksample2/

The Zksample2 app is hostet here: http://vs171030.vserver.de/test/ here .

Edit: I have get a ticket on SF for correct them.

link publish delete flag offensive edit

answered 2010-01-20 21:48:17 +0800

goldfish gravatar image goldfish

Hi terrytornado,

Do you have any plan to update zksample to ZK5 and spring 3? As you know, there many update in this two frameworks.

Thank you.

link publish delete flag offensive edit

answered 2010-01-21 03:34:19 +0800

mordor gravatar image mordor

Hi Terrytornado,

Great job! Looks very nice! Thanks a lot.
It's will be super if you upgrade zksample2 to ZK5, but I think it's should do after ZK5 release! Now I read you code and after that I'll try write you my comments.

link publish delete flag offensive edit

answered 2010-01-21 12:13:40 +0800

terrytornado gravatar image terrytornado flag of Germany
9373 3 7 16


no problem with spring 3.
It's downwards compatible.

If we have time, we will check against zk5 and make new checkin.


link publish delete flag offensive edit

answered 2010-01-21 21:12:17 +0800

goldfish gravatar image goldfish

Hi Terrytornado,

I try to update ZK3 to ZK5, only some layout api need to change. ZK5 moved some layout classes from zkex to zk core. After updated to ZK5, I found some tiny issues--the close button in login dialog did not locate at the right side. The other issue is that renderMessages in Chatter and onSendMsg in ChatWindow can't work because smartUpdate is removed from ComponentCtrl. Other features work fine.

The tiers became more clear in ZKSample2. It gives me much help to study ZK and Spring. Thanks.

link publish delete flag offensive edit

answered 2010-01-22 07:07:49 +0800

mordor gravatar image mordor

updated 2010-01-22 07:10:29 +0800

Hi Goldfish,

Also I have a problem with even onChange in Combobox component, now it's onSelect.....

Hi Terrytornado,

And what about migration to spring security 3.0.1? There a lot of changes.... It's not so simple like in spring 3 if you didn't you new futures...

link publish delete flag offensive edit

answered 2010-01-22 09:33:41 +0800

terrytornado gravatar image terrytornado flag of Germany
9373 3 7 16

updated 2010-01-22 09:39:04 +0800

@goldfish the earliest time for migrating to zk5 is when zk5 is in the maven- rep.
@mordor, @all

Hmmmmm, we have in mind to make an own security system for our needs because there's much trouble with
synchronizing the zk multithread architecture with spring security. (If you study the code you will find the place
and the method where we catch the @Secured annotation self and not by Spring-sec. if needed )

If you are a big fan on debugging and on solving such problems than you can made 4 changes and help us to find the ground
or a workaround for such a misbehavior. I hope the zk guys can have a look on it if they have time after the zk5 release.

1. de.forsthaus. webui. InitApplicationCtrl.java

- change the BaseController from which is extended.

from: public class InitApplicationCtrl extends WindowBaseCtrl implements Serializable {
to: public class InitApplicationCtrl extends GFCBaseCtrl implements Serializable {

than change ALL getters for the DAOs and Services in this class (at the end of the file)

public GuestBookService getGuestBookService() {
if (guestBookService == null) {
guestBookService = (GuestBookService) SpringUtil.getBean("guestBookService");
return guestBookService;

public GuestBookService getGuestBookService() {
return guestBookService;

2. zkoss/src/main/resources/applicationContext-zkoss.xml

insert the bean definition:

<!-- Init Pre -Page -->
<bean id="initApplicationCtrl" class="de.forsthaus.webui.InitApplicationCtrl"
parent="basisCtrl" scope="prototype">
<property name="customerService" ref="customerService" />
<property name="brancheService" ref="brancheService" />
<property name="officeService" ref="officeService" />
<property name="ipToCountryService" ref="ipToCountryService" />
<property name="articleService" ref="articleService" />
<property name="orderService" ref="orderService" />
<property name="guestBookService" ref="guestBookService" />
<property name="securityService" ref="securityService" />
<property name="userService" ref="userService" />
<property name="loginLoggingService" ref="loginLoggingService" />
<property name="sysCountryCodeService" ref="sysCountryCodeService" />

3. change the controller access in the zul file: zkoss/src/main/webapp/index.zul

<window id="startWindow" border="none" width="100%" height="100%" use="de.forsthaus.webui.InitApplicationCtrl">

<window id="startWindow" border="none" width="100%" height="100%" apply="${initApplicationCtrl}">

With these changes we have following problem:
1. start application
2. get LoginDialog
3. do a login (you can see in the console-log that i.e. you are logged in correct as admin)
4. after login Spring-security is now threw an Error: no authorization. ??????????
5. by refreshing the web page in the browser the app runs normal away.

Have fun and let us know if you find some solution.


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2010-01-17 08:29:28 +0800

Seen: 29,035 times

Last updated: May 27 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More