java - Spring MVC中的表单处理页面

标签 java spring model-view-controller spring-mvc

我是 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/

相关文章:

java - JNDI 在不检索所有数据的情况下获取 LDAP 搜索的大小

java - 如何处理相互交互的多个 Activity ?

java - 面向对象的CRUD程序——OO设计的原因是什么?

java - 如何在日语 utf-8 汉字上使用 java 子字符串

spring - 在 Spring Boot MVC 中添加 ShallowEtagHeaderFilter

qt - 在异构数据层次结构的不同 View 之间拖放

java - 如何组织Spring项目

java - 如何避免 BeanCreationException : Could not autowire field error

PHP MVC - 我的 Controller 太胖了吗?

javascript - 在 Controller 之间切换,无法更新 View