0

Methods POST and GET in ZK Framework

asked 2009-11-24 19:53:28 +0800

pax gravatar image pax
18 1 1 1

Hi zk warriors !! 8D

Actually I'm newbie in ZK framework, I have some experience with php, and I was wondering if it is possible to establish communication between zul files using methods POST and GET to send information from a form, etc. I hope you can give me a clue, Thanks :D

delete flag offensive retag edit

16 Replies

Sort by ยป oldest newest

answered 2009-11-25 05:17:47 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Do you want to call a zk page passing params in the query string?

link publish delete flag offensive edit

answered 2009-11-25 09:24:05 +0800

pax gravatar image pax
18 1 1 1

Hi Felipe, yes that is exactly what I want.

link publish delete flag offensive edit

answered 2009-11-25 16:39:35 +0800

fselva gravatar image fselva
66 1

When you receive the request, you can get the parameters with:

Executions.getCurrent().getParameterMap().get("your parameter")

link publish delete flag offensive edit

answered 2009-11-25 17:48:29 +0800

pax gravatar image pax
18 1 1 1

Wow fselva, it's a great clue, thank you so much!! :D

link publish delete flag offensive edit

answered 2009-11-25 21:02:21 +0800

lovetide gravatar image lovetide
169 1 7

updated 2009-11-25 21:17:39 +0800

and you can display the parameters using ExpressionLanguage like this:

if you pass 3 parameters to index.zul:
index.zul?username=lovetide&age=100&p_a_r_a_meterN=hahaha

you can display these parameters in index.zul file via:

username: ${param.username}
age: ${param.age}
parameterN: ${param.p_a_r_a_meterN}


the result will be:
username: lovetide
age: 100
parameterN: hahaha

link publish delete flag offensive edit

answered 2009-11-26 00:07:29 +0800

pax gravatar image pax
18 1 1 1

lovetide thanks, you have completed the puzzle, this is very helpful.

link publish delete flag offensive edit

answered 2009-11-26 01:44:41 +0800

pax gravatar image pax
18 1 1 1

Hi again lovetide, I have tested using the ExpressionsLanguage version, but zk doesn't accept the ampersand (&) in the string of parameters, my example code is this:

<button label="click me" onClick='Executions.sendRedirect("second.zul?username=MyName&pass=MyPass");' />

With ampersand character the page doens't load, without it load correctly, but MyPass becomes one data, username, Am I doing something wrong or missing something else?

Thank you for your help.

link publish delete flag offensive edit

answered 2009-11-26 05:03:19 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

@Pax, if you're are coming from zul and going to another zul why don't you use desktop attributes?

Desktop.setAttribute("username", MyName);
...
Desktop.getAttribute("username");

You should get used with ZK fundamentals.


Regards,

link publish delete flag offensive edit

answered 2009-11-26 08:12:15 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

see if this works:

<button label="click me" onClick='Executions.sendRedirect("second.zul?username=MyName&pass=MyPass");' />

It might be that the ampersand is getting hosed by the fact that ZUML is XML.

link publish delete flag offensive edit

answered 2009-11-26 16:44:14 +0800

pax gravatar image pax
18 1 1 1

updated 2009-11-26 16:46:51 +0800

Wow, this code works fine:

<button label="click me" onClick='Executions.sendRedirect("second.zul?username=TheName&password=ThePassword");' />

Works fine representing the ampersand with & amp; and & #38 (html special chars); thank you so much (Y)
Example of fmcypriano also works fine.

Thank you lovetide, your example completes the target.

Now let's get fun with method POST!!

Regards!!

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: 2009-11-24 19:53:28 +0800

Seen: 5,110 times

Last updated: Sep 18 '12

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