-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a code like this:
Map<String, Object> argsMap = new HashMap<String, Object>();
String uri = "/sm/config/dutydic/edit.zul";
argsMap.put("optionType", Constants.OPT_TYPE_UPDATE);
argsMap.put("selectedDutyDic", selectedDutyDic);
Window win = (Window) Executions.createComponents(uri, dutyDicWin, argsMap);
win.doModal();
I want to get request path by this window,the method Executions.getCurrent().getCurrentPage().getPath()
return value is path before the window open page.
thanks!I thought the same way. I wrote a filter was used to filter the path,if I can get straight to the path of the page,it is very convenient! but still thanks Greetz chill.thank you very much!
You don't have a getPath
or getUrl
in Window.
Executions.getCurrent().getCurrentPage()
returns your whole active page and your URL isn't changed.
The trick how you can do it is like this :
Map<String, Object> argsMap = new HashMap<String, Object>();
String uri = "/sm/config/dutydic/edit.zul";
argsMap.put("optionType", Constants.OPT_TYPE_UPDATE);
argsMap.put("selectedDutyDic", selectedDutyDic);
argsMap.put("uri", uri);
Window win = (Window) Executions.createComponents(uri, dutyDicWin, argsMap);
win.doModal();
and fetch the uri from your argsMap in your controller.
Greetz chill.
Hi
you can refer to the following sample
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.sys.ExecutionCtrl;
public class VM2 {
@Init
public void init(@ContextParam(ContextType.EXECUTION) Execution exec) {
exec.setAttribute("path", ((ExecutionCtrl)exec).getCurrentPageDefinition().getRequestPath());
}
}
Asked: 2014-05-18 16:37:58 +0800
Seen: 26 times
Last updated: Jun 04 '14
you need the "/sm/config/dutydic/edit.zul" in your vm of the model window?
chillworld ( 2014-05-18 19:22:02 +0800 )edit