This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

richard1

Greenhorn
+ Follow
since Aug 03, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by richard1

Hi all,
My app's jsp fragment javacript function as below:
.....
function registerData(data,page)
{
document.addForm.action='/sofTrack/registerRecord.do';
document.addForm.type.value=data;
document.addForm.pageNo.value=page;
document.addForm.submit();
}
......

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();
.....
keys.put("add.register.button","register");
keys.put("add.save.button","registerUpdate");
....
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,

Rich
14 years ago