0

Listbox setmodel returns null pointer exception on loading

asked 2011-03-21 06:39:18 +0800

yaryan997 gravatar image yaryan997
210 2

Hi.. zk team help me to solve my problem related with listbox.

Actually I am developing an application in that I want to pass my listbox selectedindex value from one controller class to another controller class..

When my zul file first invoked everything works perfectly . My listbox shows all values by using the below method

public void onCreate$filter_bar()
	{
lbox_service.setModel(new ListModelList(certilogoServiceDao.getAllServices()));
		ListModelList lml_service = (ListModelList) lbox_service.getModel();
		lml_service.add(0, "All");
}

where lbox_service is my listbox id which loads at the time when filtebar components get created. Now when i call the onCreate$filter_bar method from any another controller it gives me nullPointer exception at lbox_service.setModel(new ListModelList(certilogoServiceDao.getAllServices())); this line.

help me to solve my problem.
Best Regards
Yogendra


ok that's fine but when i call the above method

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2011-03-21 20:01:50 +0800

samchuang gravatar image samchuang
4084 4

Hi

which one is null ? certilogoServiceDao ? or getAllServices() return null ?

maybe you need to check certilogoServiceDao

link publish delete flag offensive edit

answered 2011-03-21 22:30:50 +0800

yaryan997 gravatar image yaryan997
210 2

@samchuang.

actually my certilogoServiceDao is the database controller with which i run a getAllSErvicess() query to get all services in my listbox. lbox_service

my query executes very well but the listbox listmodel returns me null..

So, my listbox might not be able to load at the time filter_bar is created.. or don't know why it is happening???


Best Regards
Yogendra

link publish delete flag offensive edit

answered 2011-03-21 22:50:40 +0800

yaryan997 gravatar image yaryan997
210 2

hello zk friends..

can you help me with my previous thread question that is it possible
to call onCreate$filter_bar method belongs to Basecontroller2
controller from onSelect$(listbox name) method belonging to
InternetSeller controller class..


if it is not possible than just tell me how to initially load all
components when one zul page is included by another zul component
belonging to two different controller's.

Best Regards
Yogendra

link publish delete flag offensive edit

answered 2011-03-22 06:25:04 +0800

yaryan997 gravatar image yaryan997
210 2

thanx to all my zk friends ..

i am able to solve my problem..

Best Regards
Yogendra

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

Follow

RSS

Stats

Asked: 2011-03-21 06:39:18 +0800

Seen: 453 times

Last updated: Mar 22 '11

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