0

How to send components values from a zul file via method POST and get them in a servlet?

asked 2011-04-12 10:04:48 +0800

airton gravatar image airton
78 1

The GET way, that exposes the values and is bad:

zul:
...
<intbox id="ibxCodSM"/>
<button label="Send" id="btnSMc"

...


Controller.java:
...
Intbox ibxCodSM;
Intbox ibxCodCidade;
public void onClick$btnSMc() {
String sv = "SMc?code=" + ibxCodSM.getValue();
execution.sendRedirect(sv, "_blank");
}

...


SMc (my servlet):
...
int code = Integer.parseInt(request.getParameter("code"));
...

So url shows: http://localhost:8080/app/SMc?code=1

I'd like an url: http://localhost:8080/app/SMc and the component code sent via POST.

Thanks a lot.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2011-04-14 08:37:58 +0800

airton gravatar image airton
78 1

Thanks, Dennis.

I'll see this option. By now, I'm using session to send the data from my class to the servlet...

link publish delete flag offensive edit

answered 2011-04-14 06:10:40 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

you could use jquery to post it
1. jquery post api here : http://api.jquery.com/jQuery.post/
2. use Clients.evalJavascript to invoke the script.

/Dennis

link publish delete flag offensive edit

answered 2011-04-13 07:44:03 +0800

airton gravatar image airton
78 1

Thanks, Maik.

I've thought I could use a ZK aprouch but seems the way is the legacy one...

link publish delete flag offensive edit
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-04-12 10:04:48 +0800

Seen: 289 times

Last updated: Apr 14 '11

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