Michael, i think i understand your point now! If my english let get the point correctly, i realized that if i have an ordinary Action, and have such method that finds out what was the value of the image tag (using your getCommand function) and delegate (probably with an "if") the processing of the request to the responsible method, i'll end up doing just what DispatchAction and LookupDispatchAction does. This way your solution certainly works perfectly. Is that it?
Thank you again, ltcmelo > Let me try again on this, Leandro, as much for > myself as for you. The > LookupDIspatchAction, which I don't care for, only > gives you one thing: a > promise that the page author will have to use a > particular name for the > parameter name to be used in the Action for deciding > which method to > use. That is it. So, somehow the page author has > to provide a value for > the parameter name you specify in your > LookupDispatchAction action mapping > xml parameter attribute. Thus, if you use > parameter='method' in your > action mapping xml, then you can know that using > 'method' in your "hidden" > values in the form will work. You can also know, of > course, that you then > MUST use the request parameter 'method' in your > form. You can do the same > thing without giving the parameter attribute of your > action mapping any > value at all. You merely have to coordinate the > page hidden parameter name > and the parameter name mined in the Action. The use > of the parameter > attribute in the action mapping MERELY forces the > page author to conform to > your requirements in the Action class, which then > becomes the > DispatchAction class or LookupDispatchActino class. > > The whole point of using an image tag solution is to > (1) get out of a > Struts specific solution to this "age old" problem > and to (2) provide a > solution to the need to make a switch in the > processing of an action. The > ".x" and ".y" in the parameter names of an image tag > operate just like the > parameter attribute of the action mapping for the > LookupDispatchAction and > DispatchAction. The difference is that it is not > Struts specific and is a > "worldwide" standard. The code which follows, viz. > > public final class ButtonCommand { > private ButtonCommand() { > } > public final static String > getCommand(HttpServletRequest request) { > Enumeration enum = request.getParameterNames(); > String parameterName = null; > while(enum.hasMoreElements()) { > parameterName = (String)enum.nextElement(); > if(parameterName.endsWith(".x")) { > return > parameterName.substring(0,parameterName.indexOf('.')); > } > } > return parameterName; > } > } > > simply does this using image tags instead of hidden > parameters in the > form. You can, of course, just copy the method > getCommand into your > processing helper classes in the model. > > Does this ring any bells? > > Michael McGrady > > At 08:09 PM 8/10/2004, you wrote: > >The problem is that both solutions in a higher > level > >focus on getting the parameter and checking it out > to > >see its value. > > > >In my case, i got a MyLookupDispatchAction that > >receives all the requests and forwards it to the > >specific method. So, there's no meanwhile to get > the > >request parameter, check it out and forward to some > >method. > > > >UNLESS, > >i use someking of hidden field in the form with a > name > >that MyLookupDispatchAction expects: > > > >protected Map getKeyMethodMap(){ > > Map map = new HashMap(); > > map.put("hidden.field", > "verifyParameterMethod"); > >} > > > >And the in the "verifyParameterMethod()", i'd use > call > > > >"getCommand(HttpServletRequest request)" to check > what > >was the value of the real parameter i want (the one > >from the image tag). Finally, i would compare this > >value and forward the data to the responsible > method. > >Am i correct? > > > > > >It just seems a little confusing... _______________________________________________________ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: http://br.acesso.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]