我是 Spring 新手,很抱歉这个问题很愚蠢。 我有 Spring MVC 形式,以及基于注释的 Controller 中的 2 个方法。
@RequestMapping(method = RequestMethod.GET)
public String getUploadForm(Model model) {
model.addAttribute(new UploadItem());
initModel(model);
return "upload/uploadForm";
}
@RequestMapping(method = RequestMethod.POST)
public String create(UploadItem uploadItem, BindingResult result, Model model) throws IOException, ServletException {
// Some type of file processing...
}
我的业务要求是添加“任务正在处理”页面,因为处理需要几分钟,所以应该通知用户,任务正在进行中(但不需要进度条)只是简单的按摩:“请等等什么的”
在 Spring 中有什么简单的方法可以做到这一点吗?
最佳答案
我认为您所追求的与 spring 并不完全相关。如果你想在一个较长的任务运行时显示一些消息,你需要使用 Ajax/JQuery 在你的较长任务执行时显示一些文本/动画。我建议你看看 this示例以查看如何使用 JQuery 执行此类操作。
关于java - Spring MVC中的表单处理页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10912205/