-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi I have been reading the docs and trying out codes.
Still i am not able to achieve a do post to another url.
Example at the "/zk/search.zul" page,
After selecting a user from this search page, i want to do a post to "/zk/edit.zul" page with the selected userId.
Then i can retrieve the userId from the request as a parameter and load the details for edit.
Currently, i am using Executions.getCurrent().sendRedirect("/zk/edit.zul?userId=1") to do the page forwarding.
But going through this method is a doGet rather than a doPost.
Cany anyone please advise me?
http://www.zkoss.org/smalltalks/legacy-validate/legacy-validate.html
Thanks Dennis, but i am not trying to do validation.
Example source on what i am trying to do:
<zscript>
public void forwardToEditScreen(Listbox listbox){
Listitem item = listbox.getSelectedItem();
String userId = item.getAttribute("userId");
//TO do a post to editWindow but currently only know how to do a redirect with doGet
Executions.getCurrent().sendRedirect("/edit_user.zul?userId="+userId);
}
</zscript>
<listbox id="users" onSelect="forwardToEditScreen(self)">
<listitem value="user1"/>
...
...
</listbox>
So how do i do a POST rather than a GET??
I think it would be much easier to work another way.
Try this:
<window id="mainWin"> <zscript> public void forwardToEditScreen(Listbox listbox) { while(content.getFirstChild() != null) content.removeChild(content.getFirstChild()); Map mParams = new HashMap(); mParams.put("USER", listbox.getSelectedItem().getValue()); Executions.createComponents("/edit_user.zul", content, mParams); // Now, your component, can access the User with Executions.getCurrent().getArg().get("USER"); } </zscript> <window id="content"> <listbox id="users" mold="select" onSelect="forwardToEditScreen(self)" > <listitem value="user1"> <listcell label="pippo"/> </listitem> <listitem value="user2"> <listcell label="pluto"/> </listitem> </listbox> </window> </window>
did you read the document ?
check these parts in document
1. a form for submit
<h:form id="updateForm" action="/updateProfile" xmlns:h="http://www.w3.org/1999/xhtml">
2. name the component need to be submit with a 'name' attribute
<textbox id="firstName" name="firstName" .....
3.submit form by ..
Clients.submitForm(Component form);
Clients.submitForm(String formId);
Asked: 2008-11-20 15:10:04 +0800
Seen: 283 times
Last updated: Nov 21 '08