Allright! Actually, my first languages "are" c++ and pascal. Why did you ask anyway!?
Thanks again, ltcmelo > ATTACHMENT part 9 message/rfc822 > Data: Wed, 11 Aug 2004 14:17:11 -0700 > Para: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > De: Michael McGrady <[EMAIL PROTECTED]> > Assunto: Re: Multiple image tags > > You got it, Leandro. > > You end up doing with this solution what the > LookupDispatchAction does with > less overhead, less of a footprint, and without all > the coupling to the > framework. I put the solution on the Struts wiki, > and a pretty good > programmer actually suggested using this solution > and adding it to > LookupDispatchAction. That really confounded me. > > What's your first language? Don't say Java! LOL > > Michael > > At 01:46 PM 8/11/2004, you wrote: > >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] ===== _________________________________ Leandro Terra C. Melo Eng. de Controle e Automação - UFMG _______________________________________________________ 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]