throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
Answer answer = (Answer) command;
boolean isNew = (answer.getAnswerId() == null);
Locale locale = request.getLocale();
if (request.getParameter("delete") != null) {
answerManager.removeAnswer(answer.getAnswerId().toString());
saveMessage(request, getText("answer.deleted", locale));
} else {
answerManager.saveAnswer(answer);
String key = (isNew) ? "answer.added" : "answer.updated";
saveMessage(request, getText(key, locale));
if (!isNew) {
return new ModelAndView("redirect:editAnswer.html", "answerId", answer.getAnswerId());
}
}
return new ModelAndView(getSuccessView());
}