N
nkunkov
Hello,
I'm using LookupDispatchAction and this action is used from a form in
which depending on the request parameter I will either have a save and
clear button, or a save, cancel and update button.
The problem is that when I only have a save and clear button, the save
button should call the savePerson method, when I have three buttons
the save button should call update method. One name, different
methods, but still one form, one jsp page.
What happens is that no matter which Save button I click it always
goes to update method.
When i rename one of the buttons in my resource file to something
else, all works perfectly fine.
I read somwhere that this is actually the expected behavior. If
that's the case, is there a good standard way of getting around this
problem? If this is not expected behavior then what am I doing wrong?
Any help will be appreciated.
Thanks
NK
here is my keyMap:
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.Save", "savePerson");
map.put("button.UpdateSave", "update");
return map;
}
----------------------------------------------------
Here is my resource file:
button.Save=Save
button.UpdateSave=Save
-----------------------------------------------------
in my jsp i have the following (cut down version of course):
<c:choose>
<c:when test='${empty requestScope.FixErrorsPage}'>
<html:submit property="method" >
<bean:message key="button.Save" />
</html:submit>
</c:when>
<ctherwise>
<html:submit property="method" >
<bean:message key="button.UpdateSave" />
</html:submit>
</ctherwise>
</c:choose>
I'm using LookupDispatchAction and this action is used from a form in
which depending on the request parameter I will either have a save and
clear button, or a save, cancel and update button.
The problem is that when I only have a save and clear button, the save
button should call the savePerson method, when I have three buttons
the save button should call update method. One name, different
methods, but still one form, one jsp page.
What happens is that no matter which Save button I click it always
goes to update method.
When i rename one of the buttons in my resource file to something
else, all works perfectly fine.
I read somwhere that this is actually the expected behavior. If
that's the case, is there a good standard way of getting around this
problem? If this is not expected behavior then what am I doing wrong?
Any help will be appreciated.
Thanks
NK
here is my keyMap:
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.Save", "savePerson");
map.put("button.UpdateSave", "update");
return map;
}
----------------------------------------------------
Here is my resource file:
button.Save=Save
button.UpdateSave=Save
-----------------------------------------------------
in my jsp i have the following (cut down version of course):
<c:choose>
<c:when test='${empty requestScope.FixErrorsPage}'>
<html:submit property="method" >
<bean:message key="button.Save" />
</html:submit>
</c:when>
<ctherwise>
<html:submit property="method" >
<bean:message key="button.UpdateSave" />
</html:submit>
</ctherwise>
</c:choose>