throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
Material material = (Material) command;
boolean isNew = (material.getMaterialId() == null);
Locale locale = request.getLocale();
if (request.getParameter("delete") != null) {
materialManager.removeMaterial(material.getMaterialId().toString());
saveMessage(request, getText("material.deleted", locale));
} else {
materialManager.saveMaterial(material);
String key = (isNew) ? "material.added" : "material.updated";
saveMessage(request, getText(key, locale));
if (material.isEdited()) {
return new ModelAndView("redirect:updating.html?id=" + material.getMaterialId() + "&fieldId=" + request.getParameter("fieldId"));
}
}
return new ModelAndView("redirect:" + material.getDocLocation());
}