0

Inter Application communication back and forth

asked 2013-03-22 14:54:27 +0800

JustVoodoo gravatar image JustVoodoo
3 1

Hi there,

here is my situation:

I have 2 ZK applications (not on the same server) A and B. In A I want to use B , which is some kind of browser, to select an object and send its name(or itself) back to A by pressing a "select" button in B.

I managed to communicate between A and B over cookies, but pressing the button in B won't cause A to read data from cookies.

I've read something about event queries but the needed scope (GROUP) is only available in ZK EE versions.

Can anyone help me with this?

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2013-03-22 15:42:48 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6
http://www.hybris.com/

updated 2013-03-22 15:45:34 +0800

There are thousand of ways to achieve this, probably the last recommendable one is a cookie.

A stupid straight forward one?

Assuming that by a security point of view there is no issue or you managed it, app A just need to expose a dedicated servlet or even just a callback.zul file:

<window>
<zscript><![CDATA[
    String id = execution.getParameter("id");
]]></zscript>
<label value="${id}"/>

</window>

so when in app B the user push the "select" button you have just to redirect to callback.zul?id=123. In callback.zul you are back to your app A and with the selected ID you can do what you have to do.

I repeat: the cookie was the last option... this is just a possible (stupid) other way to manage your scenario.

link publish delete flag offensive edit
0

answered 2013-03-24 15:36:41 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

have a look here at the zk-rabbitmq

link publish delete flag offensive edit
0

answered 2013-03-28 13:29:51 +0800

JustVoodoo gravatar image JustVoodoo
3 1

updated 2013-03-28 14:54:07 +0800

Thanks for the answer but it still doesn't work the way I want.

I tried this:

In AppA:

Executions.getCurrent().sendRedirect("h t t p://localhost:8080/AppB/main.zul?sendbackuri=/AppA/main.zul");

That will show up the browser and I can select my object and send the id back with this code below:

In AppB:

Executions.getCurrent().sendRedirect("h t t p://localhost:8080/AppA/main.zul?id=123");

The problem is, that the redirect doesn't redirect to the original AppA, but to a new AppA* . AppA* is a complete new instance and doesn't share any values with AppA. So, if i made some changes to values of AppA and redirect to AppA, all changes are gone.

I tried to load AppB with

Window w = (Window) Executions.getCurrent().createComponents("h t t p://localhost:8080/AppB/main.zul", parentThis, mapData); 
w.doModal();

But I couldn't find a way to use "createComponents" in AppA to create .zuls from AppB.

P.S. I used spaces in "h t t p", because I am not allowed to post links here due to low karma.

link publish delete flag offensive edit
0

answered 2013-03-28 17:11:12 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6
http://www.hybris.com/

updated 2013-03-29 08:31:33 +0800

a.zul

<window title="intra frame communication" border="normal">
<textbox id="here" hflex="1" />
<script type="text/javascript">
    function saySomething(message) {
        jQuery("$here").val(message);
    }
</script>
<iframe height="100px" width="100px" src="b.zul" />
</window>

b.zul

<a href="javascript:window.top.saySomething('hello world!')">greetings from app B</a>

I repeat: there are many ways to achieve this... the one i'm suggesting you is probably the stupidest but fastest. If your scenario is too complex you should try to consider maybe JSR268 (and the intra portlets communication) or an event queue approach as Stephan suggested.

link publish delete flag offensive 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

Follow
1 follower

RSS

Stats

Asked: 2013-03-22 14:54:27 +0800

Seen: 48 times

Last updated: Mar 29 '13

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