0

How find ZK componet from servlet

asked 2007-08-29 07:08:53 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4490195

By: urfindjusse

Hi.
Can I find ZK componet from servlet ?


delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2007-08-30 14:57:34 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-09-04 22:34:12 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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 ....

link publish delete flag offensive edit

answered 2007-09-05 03:55:27 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-09-16 20:49:38 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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


link publish delete flag offensive edit

answered 2007-09-22 19:54:46 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-10-07 20:08:14 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.

link publish delete flag offensive edit

answered 2007-10-08 05:14:24 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.




link publish delete flag offensive edit

answered 2007-10-08 05:46:39 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4557126

By: urfindjusse

Thanx for your answer.


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: 2007-08-29 07:08:53 +0800

Seen: 350 times

Last updated: Oct 08 '07

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