我有一些 jsp 页面 manage.jsp 和里面的表格:
<form method="POST" action="./manage.form">
<div style=" float: left;">
<textarea id="errors" name="errors">${ignoredExceptions}</textarea>
</div>
<div id="successOrErrorSave"></div>
<div style="clear: both;">
<input type="submit" id="saveIgnoredErrors" style="margin-left: auto; margin-top: 10px;" value="<spring:message code="errorlogging.ignredExceptions.save" />"/>
</div>
</form>
我有一些控制器 ManageController:
/**
* The main controller.
*/
@Controller
public class ManageController {
protected final Log log = LogFactory.getLog(getClass());
@RequestMapping(value = "/module/manage", method = RequestMethod.GET)
public void showForm(ModelMap model) {
GlobalProperty glProp = Context.getAdministrationService().getGlobalPropertyObject(
Constants.GP_IGNORED_EXCEPTION);
if (glProp != null) {
model.addAttribute("ignoredExceptions", glProp.getPropertyValue());
} else {
model.addAttribute("ignoredExceptions", "");
}
}
@RequestMapping(value = "module/manage", method = RequestMethod.POST)
public String processSubmit(@ModelAttribute(value = "ignoredExceptions") String ignoredExceprions, BindingResult result,
SessionStatus status) {
boolean successSave = false;
GlobalProperty glProp = Context.getAdministrationService().getGlobalPropertyObject(
ErrorLoggingConstants.ERRROR_LOGGING_GP_IGNORED_EXCEPTION);
if (glProp != null) {
glProp.setPropertyValue(ignoredExceprions);
GlobalProperty saved = Context.getAdministrationService().saveGlobalProperty(glProp);
System.out.println(saved.getPropertyValue());
if (saved != null && saved.getPropertyValue().equals(ignoredExceprions)) {
successSave = true;
}
}
status.setComplete();
return "module/manage";
}
}
当我在 textarea 中打开管理页面时,我正在显示当前被忽略的异常。我需要保存用户输入的新值被忽略的异常,然后重定向到相同的管理页面,该页面将查看被忽略的异常的新值。我怎样才能做到这一点?