0

how to get win.doModal path

asked 2014-05-18 16:37:58 +0800

jakzhang gravatar image jakzhang
0 1

updated 2014-05-19 09:59:20 +0800

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!

delete flag offensive retag edit

Comments

you need the "/sm/config/dutydic/edit.zul" in your vm of the model window?

chillworld ( 2014-05-18 19:22:02 +0800 )edit

3 Answers

Sort by » oldest newest most voted
0

answered 2014-05-19 03:59:29 +0800

jakzhang gravatar image jakzhang
0 1

yes! May i get the path in my vm of the model window? how can i get this?

link publish delete flag offensive edit
0

answered 2014-05-19 06:36:22 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9
https://github.com/chillw...

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.

link publish delete flag offensive edit
0

answered 2014-06-04 03:06:05 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

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());
    }
}

http://zkfiddle.org/sample/op0l6c/1-include-path

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: 2014-05-18 16:37:58 +0800

Seen: 26 times

Last updated: Jun 04 '14

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