• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

LookupDispatchAction class mapping button value to wrong method

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
My app's jsp fragment javacript function as below:
function registerData(data,page)

Properties file fragment is as below:
add.saveProgress.button=Save As In Progress
update.saveProgress.button=Save As In Progress
#add.register.button=Submit for Add Registration
#update.register.button=Submit for Update Registration

LookupDispatchAction class fragment as below:
protected Map getKeyMethodMap()
Map keys = (Map) new HashMap();
return keys;

public ActionForward register(..){.. }
public ActionForward registerUpdate(..){..}

Everytime when I click on the "add.register.button" to trigger javascript registerData() funtion , struts should invoke register() method to handle this action. But by debugging, I found it actually invokes registerUpdate()method which is supposed to handle another jsp page's action.

And if I replace the code in
getKeyMethodMap() method with the commentted code(see the above code snippet),
struts can working well to invoke correct register() method, not the wrong registerUpdate()method. Seems like that struts looks up button "label", but not "value" to decide which method to invoke. It is pretty strange and confused me. My app can work fine by the above "commented label", but not working to use the old "uncommentted" label,and my client insist to use the old one.

Any idea is appreciated,

Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Go through the documentation for getKeyMethodMap() method in LookupDispatchAction class. You will find your answer.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic