org.zkoss.zul.Window.getVariable(String,Boolean) is not found in zk 7.0.3

asked 2015-04-06 14:37:33 +0800

Aasifi gravatar image Aasifi
15 3

updated 2015-04-06 20:11:16 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9

Hello Everyone,

I have Zk calendar in my application and I have upgraded my zk libraries to 7.0.3 but I am getting error for org.zul.Window.getVariable(String,boolean) which I was working in previous version. My code looks like

SimpleCalendarModel scm = new SimpleCalendarModel(); private Window displayMyEntry;

@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); setTitle(2, Calendar.getInstance().getTime());
org.zkoss.calendar.Calendars cals = (org.zkoss.calendar.Calendars)displayMyEntry.getVariable("calendar", false);// getting error at this line

    scm = new SimpleCalendarModel();

    Sessions.getCurrent().setAttribute("learnerEvents", getTotalNumberOfEvents());

Can someone please tell me the what would I use instead of this method or any other way to void this issue as I am stuck at this issue.

Any help would greatly appropriated.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-06 20:10:13 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9

updated 2015-04-07 13:03:02 +0800

getVariable and setVariable are deprecated from version 5.0.

You have to use attributes now.

More info you can find here :


Greetz chill.

link publish delete flag offensive edit


Thanks Chillworld. Error has gone but now I have another issue.I have applied getAttribute instead of getVariable,it is giving me NULL pointer exception at that location.

SimpleCalendarModel scm = new SimpleCalendarModel();
private Window displayMyEntry;    

String dateformat=Ses
Aasifi ( 2015-04-07 13:47:38 +0800 )edit

is your window still wired?

chillworld ( 2015-04-07 14:07:27 +0800 )edit

I am not been able to see the calendar,instead it is showing me exception Failed to load /sf/index.zul

Cause: Unknown exception: java.lang.NullPointerException. java.lang.NullPointerException at com.general.GetEventsData.doAfterCompose(GetEventsData.java:64) at org.zkoss.zk.ui.impl.UiEngineImpl.d

Aasifi ( 2015-04-07 15:01:44 +0800 )edit

did you change the zul also according to the link (link is now working properly)

chillworld ( 2015-04-07 16:25:02 +0800 )edit
Your answer
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

1 follower



Asked: 2015-04-06 14:37:33 +0800

Seen: 31 times

Last updated: Apr 07 '15

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