Spring Timing Task – File upload progress bar

Spring timing tasks

Guide dependencies

  org.quartz-scheduler quartz 2.2.3  

Configure timed task class

package com.atguigu.scw.portal.service; import org.springframework.stereotype.Service; @Service public class ExampleJob {public void hello () {System.out.println("Timed task trigger ===========>");} }

Configure timed tasks

                      

Use of cron expression

Execute once every 5 seconds: */5 * * * * ?
Execute once every 1 minute: 0 */1 * * * ?
Execute once every day at 23 o'clock: 0 0 23 * * ?
Execute once every day at 1 o'clock in the morning: 0 0 1 * * ?
Executed at 1:00 am on the 1st of every month: 0 0 1 1 * ?
Executed at 23:00 on the last day of each month: 0 0 23 L * ?
Every Execute once every week at 1:00 am on Sunday: 0 0 1? * L
Execute once at 26, 29, 33: 0 26,29,33 * * * ?
Every day at 0:13 Dot, 18 o’clock, and 21 o’clock are executed once: 0 0 0,13,18,21 * * ?

Reference

https://docs.spring.io/spring/ docs/4.0.0.RELEASE/spring-framework-reference/htmlsingle/#scheduling-quartz

File upload progress bar

Ajax asynchronous submission form< code>$("#subBtn").on('click', function() {return false} is the mechanism of the js object

Click the button to submit directly is the browser’s mechanism p>

File upload

Submit the form directlyaction='${ctp}/member/upload' method='post' enctype="multipart/form-data"

60%

Ajax submissiontype: "post",contentType: false,processData: false

Progress bar: get myXhr = $.ajaxSettings.xhr() object and return

Picture preview

$("#ad_file_input").on('change', function(event) {$( this).empty() $(this).parent('.form-group').next('.form-group').find('.imgdiv').empty() fileList = event.currentTarget.files log('fileList==============>', fileList) var URL = window.URL || window.webkitURL var imgURL //traverse the uploaded files Display $.each(fileList, function (index, item) {//Create a temporary URL address imgURL = URL.createObjectURL(item) log('this=========>',this) log( 'item==========>',item) $('#ad_file_input').parent(".form-group").next(".form-group").find(".imgdiv ").append("").append('

'+item.name+'

') }) })

Leave a Comment

Your email address will not be published.