You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erik Weber <er...@mindspring.com> on 2004/08/06 01:11:08 UTC

Finding an ActionMapping

In Action.execute, is there a way to obtain a reference to an 
alternative action mapping (not the one that is passed as an argument to 
the method) using the "parameter" attribute of that alternative mapping? 
In other words, if there exists an action mapping with the "parameter" 
attribute set to "foo", can I do a lookup (or reconstruction) somehow of 
an ActionMapping instance for that action mapping using the parameter value?

Thanks,
Erik
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Finding an ActionMapping

Posted by Kishore Senji <ks...@gmail.com>.
protected ActionMapping getActionMapping(ActionMapping mapping, String
parameter){
  if(mapping == null){
    return null;
  }
  ModuleConfig mc = mapping.getModuleConfig();
  ActionConfig acs[] = mc.findActionConfigs();
  ActionConfig ac = null;
  for(int i=0; i<acs.length; i++){
    if(StringUtils.equals(ac.getParameter(), parameter)){ //
org.apache.commons.lang.StringUtils
      ac = acs[i];
      break;
    }
  }
  return ac;
}

Thanks,

Kishore Senji.

On Thu, 05 Aug 2004 19:11:08 -0400, Erik Weber <er...@mindspring.com> wrote:
> In Action.execute, is there a way to obtain a reference to an
> alternative action mapping (not the one that is passed as an argument to
> the method) using the "parameter" attribute of that alternative mapping?
> In other words, if there exists an action mapping with the "parameter"
> attribute set to "foo", can I do a lookup (or reconstruction) somehow of
> an ActionMapping instance for that action mapping using the parameter value?
> 
> Thanks,
> Erik
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org