-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4490195
By: urfindjusse
Hi.
Can I find ZK componet from servlet ?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4492872
By: jumperchen
Hi,
Try the following two ways,
1)Path.getComponent("//pageId/componentId");
2)Executions.getCurrent().getDesktop().getPage("pageId").getFellow("componentId"
);
/Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4501372
By: urfindjusse
i have
<?xml version="1.0" encoding="UTF-8"?>
<?page id="a1" ?>
<window id="docarea" border="normal" width="100%" sclass="wndcyan"
xmlns:h="http://www.w3.org/1999/xhtml" sizable="true" > <toolbar width="100%">
<toolbarbutton label="?????????" onClick="show()" />
</toolbar>
</window>
<zscript>
void show(){
Window wait = new Window("????","normal", true);
wait.id= "await";
wait.mode = "highlighted";
wait.width = "370px";
wait.setParent(Path.getComponent("/docarea"));
Label lb = new Label();
lb.value = "????????? ???????? ??????";
lb.setParent(Path.getComponent("/docarea/await"));
}
</zscript>
if in <zscript> i call
Window wi = (Window)Path.getComponent("//a1/docarea/await");
wi.setTitle("New Title");
all fine
but in servlet i get NullPointerException ....
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4501632
By: jumperchen
Hi UrfinDjusse,
Once the "wait" window component is closed, you cannot get its instance.
/Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4521228
By: urfindjusse
Try do simple thing in server side like this
try{
System.out.println("
ID desktop"+Executions.getCurrent().getDesktop().getId());
}catch(Exception ex){
ex.printStackTrace();
}
always I get
java.lang.NullPointerException
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4532348
By: henrichen
Where did you call this? And who is the NULL object?
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4556744
By: urfindjusse
I have a lots of HTML forms. All data from fields send with DWR. When i try from DWR find ZK object on server side null pointer exception occurs. DWR is getahead.org/dwr.
Can I use DWR and ZK together ?
Thanx.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4557102
By: zanyking
answer the NullPointerException problem:
Executions.getCurrent().getDesktop()... can only works in "ZK world".
Every time a http request incoming(no matter it is a new Html Page request or AJAX request), ZK create a new Execution to handle it, so the Execution that the getcurrent() method's returned can only survive in zkLoader or auEngine's processing time.
Although ZK store user's data in HttpSession so you can find all you want there but this is not recommended, because there's synchronization issue will cause too many side effect.
(HttpSession-> (ZK) SerializableSession->...)
think about when you try to get something from the component tree in your servlet thread and user press F5 on browser which send a message to kill whole the things.
Maybe you mix ZK with other AJAX technology nn the same document(like jsp) so you are very sure this scenario won't happen but you still need to face race condition.
the right way to get ZK Component's properties in other servlet, is store the value you want in third party Framework like Spring or Hibernat and "read" the value through this framework in your Servlet.
if you want to "update" values in ZK, use ZK serverpush and do the update work in ZK's managed environment.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4557126
By: urfindjusse
Thanx for your answer.
Asked: 2007-08-29 07:08:53 +0800
Seen: 350 times
Last updated: Oct 08 '07