JavaScript È°¿ëÆÁ
2019.11.13 / 22:46

jQuery Multiple File Upload with Progress bar - ¸ð¹ÙÀÏÀ¥ À̹ÌÁö ¸ÖƼ ÆÄÀÏ ¾÷·Îµå

ÇËÇ÷¯
Ãßõ ¼ö 333
WEB (HTML, CSS)

jQuery Multiple File Upload with Progress bar

ºê¶óÀ̾ð7 2013.11.05 14:04

jQuery Upload File

https://github.com/hayageek/jquery-upload-file


jQuery Multiple File Upload with Progress bar Tutorial

 

[¿ø¹®] http://hayageek.com/jquery-multiple-file-upload/

 

jQuery Upload File Plugin Demo

 

http://hayageek.com/docs/jquery-upload-file.php

 

Jquery Multiple File Upload Demo

 

http://hayageek.com/examples/jquery/jquery-multiple-file-upload/index.php

 

 

 

 

È­¸éµµ ±ò²ûÇÏ°í, ÇÑ°¡Áö ´õ ÁÁÀº Á¡Àº ¾÷·Îµå ÇÏ´Â Áß°£¿¡ cancel ¹öÆ°ÀÌ À־ cancel ¸¦ ÇÒ ¼ö ÀÖ´Ù´Â °ÍÀÌ´Ù.

 

Spring MVC Framework ¸¦ ¸¸µé¾î¼­ ÀÌ°ÍÀ» Àû¿ëÇØ º¸¾Ò´Âµ¥,

Chrome ¿¡¼­´Â Àß µÇ´Âµ¥, IE 9 ¿¡¼­´Â ¾÷·Îµå°¡ ¿Ï·á ¾ÈµÇ°í, °á°ú¸¦ download ¹ÞÀ¸·Á°í ÇÑ´Ù.

 

Multi File Uploader ¸¦ ÃʱâÈ­ ½Ãų ¶§

returnType:"json"

¿É¼ÇÀ» Á൵ ¸¶Âù°¡Áö´Ù.

 

Fiddler ¿¡¼­ HTTP header Á¤º¸¸¦ º¸´Ï IE 9 ¿¡¼­´Â

Content-Type: application/json

ÀÌ·¯¸é ¹®Á¦°¡ ¾ø´Â°Í °°Àºµ¥,

Content-Type: application/json;charset=UTF-8

ÀÌ·¸°Ô °¡¸é °á°ú¸¦ ´Ù¿î·Îµå ¹ÞÀ¸·Á°í ÇÑ´Ù.

 

IE 9 ÀÇ ¹ö±×ÀÎÁö...


Sample ÆäÀÌÁö¸¦ IE9 ¿¡¼­ ½ÇÇàÇØ º¸¸é Àß µÇ´Âµ¥, ¾÷·ÎµåÇÑ °á°ú¸¦ Content-Type: text/html À¸·Î º¸³»ÁÖ°í ÀÖ¾ú´Ù.

 

Áö±Ý ÇÁ·ÎÁ§Æ®¿¡¼­´Â Spring Framework 3.1.2 ¸¦ »ç¿ë ÁßÀε¥,

Spring ¼³Á¤ ÆÄÀÏ¿¡¼­

 

<!-- json result  -->
<bean id="jsonView" class="net.sf.json.spring.web.servlet.view.JsonView">
    <property name="contentType" value="application/json"/>
</bean>

 

ÀÌ·¸°Ô Çصµ

Content-Type: application/json;charset=UTF-8

ÀÌ·¸°Ô Header Á¤º¸°¡ »ý±ä´Ù.

contentType ÀÇ property ¸¦ »èÁ¦Çصµ µðÆúÆ®·Î ÀÌ·¸°Ô Content-Type ÀÌ »ý±ä´Ù.

 

IE 9 ¿¡¼­ Multiple File Upload Example Àº Àß ½ÇÇàµÈ´Ù.

http://hayageek.com/examples/jquery/jquery-multiple-file-upload/index.php )

Fiddler ·Î HTTP Header¸¦ ºÁ º¸¸é

Content-Type: text/html

·Î µÇ¾î ÀÖ´Ù.

 

±×·¡¼­ jsonView ¿¡¼­ Content-Type À» application/json ´ë½Å text/html ·Î ¹Ù²å´Ù.

±¸±Û¿¡¼­ °Ë»öÇغ¸´Ï application/json À¸·Î ÇÏ¸é ¹®Á¦°¡ ÀÖ´Â °Í °°´Ù.

 

[Ãâó] http://stackoverflow.com/questions/5388893/ie9-json-data-do-you-want-to-open-or-save-this-file

In my case when contentType in response header is "application/json; charset=UTF-8", the IE 9 shows that Prompt. But changed to "text/html" then the prompt does not show, although all other browsers are fine with the "application/json; charset=UTF-8".

 

[Ãâó] http://stackoverflow.com/questions/267546/correct-content-type-http-header-for-json

application/json is favored but usually web browsers don't know what to do with those headers and screws it up. For stuff like jquery, I have seen text/html recommended. If you are having errors pop up (e.g. download dialog box) then try text/html

 

Spring ¼³Á¤ ÆÄÀÏ¿¡¼­ ´ÙÀ½°ú °°ÀÌ ¼öÁ¤Çß´Ù.

 <!-- json result  -->
 <bean id="jsonView" class="net.sf.json.spring.web.servlet.view.JsonView">
  <!-- <property name="contentType" value="application/json;charset=UTF-8"/> -->
  <property name="contentType" value="text/html; charset=UTF-8" />
 </bean>

 

HTTP Header Á¤º¸°¡

Content-Type: text/html;charset=UTF-8

ÀÌ·¸°Ô ¹Ù²ï´Ù. IE9 ¿¡¼­ jQuery File Upload µµ Àß µÇ°í, json À» »ç¿ëÇÏ´Â µ¥µµ ÀüÇô ¹®Á¦°¡ ¾ø¾ú´Ù.


´ë½Å¿¡ jQuery ¿¡¼­ $.ajax() ·Î call ÇÒ ¶§ dataType ¿É¼ÇÀ» ¾È ÁáÀ»¶§ Content-Type ÀÌ application/json À̾úÀ» ¶§´Â ¹Þ¾Æ¿Â ¹®ÀÚ¿­À» ÀÚµ¿À¸·Î json °´Ã¼·Î parsing ÇßÁö¸¸, Content-Type À» text/html ·Î ¹Ù²Ù°Ô µÇ¸é 

data = $.parseJSON(data);

ÀÌ·¸°Ô Çѹø parsing À» ÇØÁà¾ß json °´Ã¼·Î ÀνÄÇÑ´Ù.


[2015-04-03]

IE9 ¿¡¼­ ¾÷·Îµå¸¦ ½ÇÇàÇÏ°í ³ª¼­ ±× °á°ú¸¦ ´Ù¿î·Îµå ¹ÞÀ¸·Á´Â ÀÌÀ¯´Â HTTP Request HeaderÀÇ Accept °ª ¶§¹®À̾ú´Ù.

IE9 ¿¡¼­µµ jQueryÀÇ $.ajax() ·Î È£ÃâÇÒ ¶§, (dataType: "json" ¿É¼ÇÀ» ÁÖ°í ½ÇÇà) Á¤»óÀûÀ¸·Î json µ¥ÀÌÅ͸¦ ó¸®ÇÑ´Ù.


IE9¿¡¼­ Á¤»óÀûÀ¸·Î json °´Ã¼¸¦ Ã³¸®ÇÑ °æ¿ì (Fiddler Application ĸÃÄ)



¾Æ·¡ À̹ÌÁö´Â jQuery Multiple File Upload ÇÒ ¶§, IE9 ¿¡¼­ ¿äûÀ» º¸³»°í ´Ù¿î·Îµå ¹ÞÀ¸·Á°í ÇÒ ¶§ÀÇ Fiddler ĸÃÄÇÑ À̹ÌÁöÀÌ´Ù.





¾Æ·¡´Â Chrome¿¡¼­ jQuery Multiple File Upload ¶óÀ̺귯¸®¿¡¼­ ¾÷·Îµå ÇÒ ¶§ÀÇ ÆÐŶ ĸÃÄ À̹ÌÁöÀÌ´Ù.



IE9 ¿¡¼­ ¾÷·Îµå ÇÏ°í ³ª¼­ °á°ú¸¦ ´Ù¿î·Îµå ¹ÞÀ¸·Á ÇÒ ¶§´Â Request HeaderÀÇ Accept °ªÀÌ application/json, text/javascript °¡ ¾Æ´Ï¶ó application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, *.* À¸·Î ÀÌ»óÇÏ°Ô µÈ °ÍÀ» ¾Ë ¼ö ÀÖ´Ù.


https://rawgithub.com/hayageek/jquery-upload-file/master/js/jquery.uploadfile.min.js

http://malsup.github.io/jquery.form.js


À§ 2°³ÀÇ ¶óÀ̺귯¸® Áß Çϳª¿¡¼­ IE9 ¿¡¼­ º¸³¾ ¶§´Â Accept Çì´õ¸¦ Àß ¸ø º¸³»´Â ¹ö±×°¡ ÀÖ´Â °Í °°´Ù.


³»°¡ ÀÌ ¹ö±×¸¦ ã¾Æ³»¼­ °íÄ¡±â º¸´Ù´Â ±×³É jQuery Multiple File Upload ¶óÀ̺귯¸®¸¦ ÀÌ¿ëÇؼ­ ¾÷·Îµå ÇÒ ¶§¸¸ ResponseÀÇ Content-Type À» applicatoin/json ÀÌ ¾Æ´Ï¶ó  text/html ·Î º¸³»¼­ ÇØ°áÇϱâ·Î Çß´Ù.


Spring FrameworkÀÇ Controller. (¾Æ·¡¿Í °°ÀÌ Çϸé ResponseÀÇ Header¿¡¼­ Content-Type: application/json À¸·Î µÈ´Ù.)

@RequestMapping(value="/uploadLabExcelFile", method = RequestMethod.POST)
@ResponseBody
public Map<String , Object> uploadLabExcelFile(@RequestParam Map<String , Object> param, @RequestParam MultipartFile uploadFile) throws IOException {

	int cnt = labService.uploadLabExcelFile(uploadFile);

	logger.debug("########### Update Record Count: " + cnt);
	Map<String , Object> result = new HashMap<String , Object>();
	Map<String , Object> data = new HashMap<String , Object>();
	data.put("updateCount", cnt);

	result.put("message", new Message());
	result.put("data", data);

	return result;
}


¾Æ·¡¿Í °°ÀÌ ¼öÁ¤ÇÑ´Ù. ÀÌ·¸°Ô Çϸé ÀÌ Controller ¿¡¼­¸¸ ResponseÀÇ Header¿¡¼­ Content-Type: text/html À¸·Î µÇ¸é¼­ IE9 ³ª Chrome ¿¡¼­ jQuery upload library°¡ ´Ù Àß ÀÛµ¿ÇÑ´Ù.


@RequestMapping(value="/uploadLabExcelFile", method = RequestMethod.POST, produces="text/html")
@ResponseBody
public String uploadLabExcelFile(@RequestParam Map<String,Object> param, @RequestParam MultipartFile uploadFile) throws IOException {

	int cnt = labService.uploadLabExcelFile(uploadFile);

	logger.debug("########### Update Record Count: " + cnt);
	Map<String , Object> result = new HashMap<String , Object>();
	Map<String , Object> data = new HashMap<String , Object>();
	data.put("updateCount", cnt);

	result.put("message", new Message());
	result.put("data", data);

	com.fasterxml.jackson.databind.ObjectMapper mapper = new ObjectMapper();

	return mapper.writeValueAsString(result);
}


[Âü°í] How to Convert Java Object To/From JSON


http://www.mkyong.com/java/how-to-convert-java-object-to-from-json-jackson/


¾÷·Îµå Çϱâ Àü¿¡ Check ÇÏ´Â ·ÎÁ÷À» Ãß°¡ÇÏ·Á¸é...


$(document).ready(function() {

// Upload Setting

var settings = {

    url: CONTEXT+"/input-data/uploadLabExcelFile",

    method: "POST",

    returnType:"json",

    allowedTypes:"xls,xlsx",

    fileName: "uploadFile",

    multiple: false,

    onSubmit: function(files) {

     //files : List of files to be uploaded

     //return false; to stop upload

     if( $("#selectProjectList").val()=="no-select" ) {

     alert("¸ÕÀú Project¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä. [onSubmit]");

     return false;

     }

     $("#fileUploaderStatus").html("");

    },

    onSuccess: function(files,data,xhr)

    {

        if(data.message.rstCd == "0000") {

         $("#fileUploaderStatus").html("<font color='green'>½ÇÇè Á¤º¸ ¾÷·Îµå°¡ ¼º°øÀûÀ¸·Î 󸮵Ǿú½À´Ï´Ù. ( " + data.data.updateCount + " °Ç)</font>");

        } else {

         $("#fileUploaderStatus").html("<font color='red'>" + data.rstMsg + "</font>");

         alert(data.rstMsg);

         if( data.rstCd == "0103" ) {

         location.href = "/";

         }

        }

    },

    onError: function(files,status,errMsg)

    {

        $("#fileUploaderStatus").html("<font color='red'>¾÷·Îµå°¡ ½ÇÆÐÇß½À´Ï´Ù.</font>");

    }

};

$("#mulitplefileuploader").uploadFile(settings);


setTimeout(function() {

$("input[name=uploadFile]").click(function(){

     if( $("#selectProjectList").val()=="no-select" ) {

     alert("¸ÕÀú Project¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");

     return false;

     }

     return true;

});

}, 1000);

});


À§¿¡¼­Ã³·³ setTimeout() À¸·Î 1Ãʸ¦ Áà¾ßÁö Chrome¿¡¼­µµ Á¦´ë·Î üũ°¡ µÇ¾ú´Ù.

onSubmit: function(files) { ... } ¾È¿¡ üũ ·ÎÁ÷À» µÎ¸é, Upload ¹öÆ°À» ´©¸¦¶§ ¹Ù·Î üũµÇ´Â °Ô ¾Æ´Ï¶ó ÆÄÀÏ ¼±Åà ´ëÈ­»óÀÚ°¡ ¶ß°í ³ª¼­ È®ÀÎ ¹öÆ°À» ´©¸£°í ³ª¼­¾ß üũ°¡ µÈ´Ù.


¾÷·Îµå ÇÒ ¶§ ºÎ°¡ÀûÀÎ Á¤º¸ °°ÀÌ º¸³»±â


[ÂüÁ¶] https://github.com/hayageek/jquery-upload-file


Options Ç׸ñ Áß¿¡

dynamicFormData ¿É¼ÇÀ» ÀÌ¿ëÇÏ¸é µÈ´Ù.

e.g. var settings = { dynamicFormData: function() { var data={"projectId": $('#selectProjectList').val() }; return data; } ... }


ºÎ°¡ÀûÀÎ Á¤º¸°¡ ¹Ù²ð ¶§¸¶´Ù 

$("div.ajax-upload-dragdrop").remove(); ¸¦ ÇÏ°í,

var settings = { formData: "»õ·Î¿î°ª" , ... };

$("#mulitplefileuploader").uploadFile(settings);

ÀÌ·¸°Ô Çß´õ´Ï, Chrome Browser¿¡¼­´Â Àß ¼öÇàµÇÁö¸¸,

IE9 ¿¡¼­´Â ¾Æ¿¹ upload °¡ µÇÁö ¾Ê¾Ò´Ù.


[2015-04-07]

ContentNegotiatingViewResolver ¸¦ ÀÌ¿ëÇؼ­ text/html ·Î json ÀÀ´ä º¸³»±â


Spring Framework¿¡¼­ Á¦°øÇϴ org.springframework.web.servlet.view.BeanNameViewResolver ¸¦ ÀÌ¿ëÇؼ­ text/html ·Î json ÀÀ´äÀ» º¸³»°í ½Í¾ú´Ù. ¿Ö³ÄÇϸé json ¿äûÀÏ °æ¿ì¸¸ µû·Î ó¸®ÇÏ´Â Exception Handler¸¦ ¸¸µé°í ½Í¾ú±â ¶§¹®ÀÌ´Ù.


json ¿äûÀÏ °æ¿ì´Â ·Î±×ÀÎÀÌ ¾ÈµÇ¾î ÀÖ´Â °æ¿ì³ª, ¼­¹ö¿¡¼­ ¿¡·¯°¡ ³­ °æ¿ìµµ ¿¡·¯ ¸Þ½ÃÁö¸¦ json ÇüÅ·ΠÁà¾ßÁö Á¦´ë·Î 󸮰¡ µÇ¹Ç·Î...


±×·¡¼­ Ajax·Î ¿äûÀ» º¸³¾ ¶§ url µÚ¿¡ .json À» ºÙ¿´´Ù. @ExceptionHandler ¸Þ¼­µå¿¡¼­´Â requestÀÇ URLÀÇ ³¡¿¡ .json ÀÌ ÀÖ´ÂÁö È®ÀÎÇؼ­ mav.setViewName("jsonView"); ÀÌ·¸°Ô ó¸®Çß´Ù.


package com.examples.project.main.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;

import com.examples.project.common.domain.Message;

@ControllerAdvice
public class GlobalDefaultExceptionHandler {

	public static final String DEFAULT_ERROR_VIEW = "error";

	@ExceptionHandler(value = Exception.class)
	public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception {
		// If the exception is annotated with @ResponseStatus rethrow it and let
		// the framework handle it - like the OrderNotFoundException example
		// at the start of this post.
		// AnnotationUtils is a Spring Framework utility class.
		if( AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null) {
			throw e;
		}

		System.out.println(req.getRequestURL());

		ModelAndView mav = new ModelAndView();
		if( req.getRequestURL().toString().endsWith(".json") ) {
			mav.setViewName("jsonView");
			String errorCode = (String)req.getAttribute("errorCode");
			mav.addObject("message", new Message(errorCode, new String[]{e.getMessage()}));
		} else {
			// Otherwise setup and send the user to a default error-view.
			mav.addObject("exception", e);
			mav.addObject("url", req.getRequestURL());
			mav.setViewName("exception/" + DEFAULT_ERROR_VIEW);
		}

		return mav;
	}

}


Controller ¿¡¼­ URL µÚ¿¡ .jsonÀÌ ºÙÀº ÀÀ´äÀ» ó¸®Çϱâ À§Çؼ­´Â ContentNegotiatingViewResolver ¸¦ ¾ÈÀÇ jsonView·Î ½ÇÇàµÇ¾î¾ß ÇÑ´Ù.

Controller Method À§¿¡ @ResponseBody ¸¦ ºÙÀÌ¸é ¾ÈµÇ°í, @RequestMapping ¿¡¼­ produces="text/html" µµ ³ÖÀ¸¸é ¾ÈµÈ´Ù.


@RequestMapping(value="/uploadLabExcelFile", method = RequestMethod.POST)
public String uploadLabExcelFile(@RequestParam Map<String,Object> param, @RequestParam MultipartFile uploadFile, HttpServletRequest request, Model model) throws IOException {

	String projectId = (String)param.get("projectId");

	request.setAttribute("errorCode", "0401");

	int cnt = labService.uploadLabExcelFile(uploadFile, projectId);

	logger.debug("########### Update Record Count: " + cnt);
	Map<String, Object> data = new HashMap<String, Object>();
	data.put("updateCount", cnt);

	model.addAttribute("message", new Message());
	model.addAttribute("data", data);

	return "jsonView";
}



Spring ¼³Á¤ ÆÄÀÏÀÇ ¼³Á¤Àº ´ÙÀ½°ú °°´Ù.


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">

	<!-- Use spring servlet for all requests, including static resources -->
    <mvc:default-servlet-handler/>

	<!-- Use @MVC annotations -->
    <mvc:annotation-driven />

	<!-- User @Controller, @Service... annotations -->
    <context:component-scan base-package="com.examples.project" />

	<!-- **************************************************************** -->
	<!-- Configration -->
	<!-- **************************************************************** -->
	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<!-- <value>classpath:config/jdbc.properties</value> -->
				<value>classpath:config/mail.properties</value>
			</list>
		</property>
	</bean>

	<util:properties id="config" location="classpath:config/config.properties" />
	<util:properties id="mail" location="classpath:config/mail.properties" />

	<!-- Application Message Bundle -->
	<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
		<property name="basename" value="classpath:/message/messages" />
		<property name="cacheSeconds" value="3000" />
	</bean>

	<bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
		<!-- <property name="contentType" value="application/json;charset=UTF-8"/> -->
		<property name="contentType" value="text/html;charset=UTF-8"/>
	</bean>

	<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
		<property name="contentNegotiationManager">
			<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
				<property name="mediaTypes">
					<value>
						json=text/html;charset=UTF-8
					</value>
				</property>
			</bean>
		</property>
		<property name="viewResolvers">
			<list>
				<bean id="beanNameResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver" />

			    <bean id="viewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
			        <property name="templateEngine" ref="templateEngine" />
			        <property name="characterEncoding" value="UTF-8" />
			    </bean>
			</list>
		</property>
		<property name="defaultViews">
			<list>
				<ref bean="jsonView" />
			</list>
		</property>
	</bean>

	<!-- Thymeleaf template engine -->
    <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
        <property name="prefix" value="/WEB-INF/views/" />
		<property name="suffix" value=".html" />
        <property name="templateMode" value="HTML5" />
        <property name="characterEncoding" value="UTF-8" />
        <!-- Template cache is true by default. Set to false if you want -->
        <!-- templates to be automatically updated when modified.        -->
        <property name="cacheable" value="false" />
    </bean>

    <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
        <property name="templateResolver" ref="templateResolver" />
        <property name="additionalDialects">
            <set>
                <bean class="org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect" />
                <bean class="nz.net.ultraq.thymeleaf.LayoutDialect" />
            </set>
        </property>
    </bean>

	<!-- **************************************************************** -->
	<!-- Include Spring Environment -->
	<!-- **************************************************************** -->
	<!-- <import resource="spring-exception.xml" /> -->

    <!-- Java Mail -->
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
		<property name="host" value="${mail.host}" />
		<property name="port" value="${mail.port}" />
		<property name="username" value="${mail.senderEmail}" />
		<property name="password" value="${mail.senderPassword}" />
		<property name="javaMailProperties">
			<props>
				<prop key="mail.transport.protocol">smtp</prop>
				<prop key="mail.smtp.auth">true</prop>
				<prop key="mail.smtp.starttls.enable">true</prop>
			</props>
		</property>
	</bean>

	<!-- **************************************************************** -->
	<!-- interceptors -->
	<!-- **************************************************************** -->
	<mvc:interceptors>
		<bean class="com.examples.project.common.interceptor.HandlerInterceptor" />
	</mvc:interceptors>

	<!-- For Multipart Upload -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />

</beans>


[Âü°í] 

Spring 3.2·Î ¿À¸é¼­ ¹Ù²ï MVCÂÊ ¼³Á¤


http://egloos.zum.com/cj848/v/372874


Spring 3 MVC ContentNegotiatingViewResolver Example

http://www.mkyong.com/spring-mvc/spring-3-mvc-contentnegotiatingviewresolver-example/


3.1.ContentNegotiatingViewResolver


Error Handling for REST with Spring

2. Solution 1 – The Controller level @ExceptionHandler



[2015-08-03]

Multifile Upload¸¦ ÇÒ ¶§, °°ÀÌ ¾÷·Îµå ÇÏ´Â ÆÄÀϵ鿡°Ô ¾î¶² µ¿ÀÏÇÑ Data¸¦ ºÎ¿©ÇÏ°í ½Í¾ú´Ù.
¿©·¯ °³ÀÇ ÆÄÀÏÀ» ¾÷·Îµå Çϱâ Àü¿¡ ¼­¹ö¿¡¼­ ¾î¶² Data¸¦ °¡Á®¿À±â À§Çؼ­´Â ¾î¶² À̺¥Æ®¸¦ ÀÌ¿ëÇÏ´Â °ÍÀÌ ÁÁÀ»±î?
onSubmit À̺¥Æ®´Â ¿©·¯ °³ÀÇ ÆÄÀϵéÀÌ °¢ÀÚ ¾÷·Îµå µÉ ¶§¸¶´Ù ºÒ·È´Ù.
ÀÌ·± °æ¿ì °¡Àå Àû´çÇÑ À̺¥Æ®´Â onSelect À̺¥Æ®¿´´Ù.


onSelect À̺¥Æ®¿¡¼­ Ajax·Î Data(ÀϷùøÈ£)¸¦ °¡Á®¿Í¼­, Hidden TypeÀÇ Input Control¿¡ ÀÔ·ÂÇØ ³õ°í, dynamicFormData ·Î ÀÌ °ªÀ» ¼­¹ö·Î ³Ñ°ÜÁÖ¸é µÈ´Ù.




[2015-08-05]

onSelect À̺¥Æ®¿¡¼­ ¾î¶² Á¶°Ç¿¡ ÀÇÇØ return false; ¸¦ ÇÏ°Ô µÇ¸é, µ¿ÀÏÇÑ ÆÄÀÏÀ» ´Ù½Ã select ÇßÀ» ¶§ onSelect À̺¥Æ®°¡ ºÒ¸®Áö ¾Ê´Â´Ù. ±×·¡¼­ onSelect event handler¿¡ ÀÖ´ø return false; ±¸¹®À» onSelect event handler·Î ¿Å°å´Ù.


¸ÖƼ ÆÄÀÏ ¾÷·Îµå ½Ã¿¡ onSubmit event handler¿¡¼­ return false; 

¸¦ ÇÏ°Ô µÇ¸é ´ÙÀ½ ¹ø ¾÷·Îµå ºÎÅʹ "afterUploadAll" event °¡ ºÒ¸®Áö ¾Ê´Â´Ù.

http://hayageek.com/docs/jquery-upload-file.php#doc ¿¡ comment ¸¦ ´Þ¾Æ ³õ¾Ò´Ù.



Ãâó: https://bryan7.tistory.com/173 [¹Î¼­³×Áý]