0

How to extract parameters from URL?

asked 2010-04-08 12:38:07 +0800

davout gravatar image davout
1429 3 18

In my ZK web app there is an option to pass some starting parameters on the URL, like...

   http://localhost:8080/test1/extaction.zul?customerID=222&action=32055¤t_project_id=146


How do I retrieve these URL parameters from within a composer class?

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2010-04-08 17:37:38 +0800

robertpic71 gravatar image robertpic71
1275 1

Hi,

public void doAfterCompose(Component component) throws Exception {
...
value = component.getDesktop().getExecution().getParameterMap();  // or
value = component.getDesktop().getExecution().getParameter("name"); // or
value = component.getDesktop().getExecution().getParameterValues("name"); // or
nativeRequest = (HttpServletRequest) component.getDesktop().getExecution().getNativeRequest(); 
..

/Robert

link publish delete flag offensive edit

answered 2010-04-09 02:58:57 +0800

davout gravatar image davout
1429 3 18

I've already tried your suggestions and something isn't working.

My incoming URL is...

http://localhost:8080/skap/extaction.zul?externalID=eis&action=32055¤t_project_id=146

When I run the following code...

   private void extractParams() {
      Map aMap = getDesktop().getExecution().getParameterMap();
      for (Object aKey : aMap.keySet()) {
         Object aValue = aMap.get(aKey);
         GeneralNavigator.setAttribute((String) aKey, (String) aValue);
      }
   }


.... I'm getting nonsense out of the getParameter calls. For instance the first iteration through the map returns a key of 'dtid' and a value of 'g9n4'

Any ideas??

link publish delete flag offensive edit

answered 2010-04-09 03:02:55 +0800

davout gravatar image davout
1429 3 18

That should be....

http://localhost:8080/skap/extaction.zul?externalID=eis&action=32055¤t_project_id=146 

link publish delete flag offensive edit

answered 2010-04-09 03:06:49 +0800

davout gravatar image davout
1429 3 18

For some reason the incoming URL isn't displaying properly in the forum message, it should read...

     http://localhost:8080/skap/extaction.zul?externalID=eis&action=32055¤t_project_id=146 

link publish delete flag offensive edit

answered 2010-04-09 03:08:07 +0800

davout gravatar image davout
1429 3 18

Again, it hasn't displayed properly... the params are...

           externalID= eis
           action=32055
           current_project_id=146

link publish delete flag offensive edit

answered 2010-04-09 03:58:27 +0800

davout gravatar image davout
1429 3 18

duh..... my error I was pulling the parameters in the wrong place, AFTER a user action not when the form is first loaded.

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: 2010-04-08 12:38:07 +0800

Seen: 488 times

Last updated: Apr 09 '10

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