Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Webwork2 Multiple Buttons In Form

DZone's Guide to

Webwork2 Multiple Buttons In Form

·
Free Resource
To react on multiple buttons in webforms use the following if you don't want to depend on the value attribute of the button (think of i18n):


 
And in the action: class FooAction implements Action { private Map buttonAction = new HashMap(); public Map getButtonAction() { return buttonAction; } public String execute() { if(buttonAction.containsKey("ok") { // ok was pressed } else if (buttonAction.containsKey("cancel") { // cancel was } else { // no button was pressed (enter key?) } ... } }
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}