조각이론
Spring multi form ajax 본문
https://okky.kr/article/313916
vo
private String content;
private List <workExcel> excelList;
getter, setter..
jsp
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<script>
$(document).ready(function(){
$("#ReadingInfoSelectBtn").click(function(){
var formData = $("#dataForm").serialize();
$.ajax({
type : "POST",
url : "${pageContext.request.contextPath}/workspaces/uploadTest",
cache : false,
data : formData,
success : function(json, status){
alert('성공 했습니다');
},
error : function(request,status,error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
});
});
</script>
<body>
<form:form commandName="dataForm" name="dataForm" id="dataForm" >
<input type="text" name="excelList[0].content" >
<input type="text" name="excelList[1].content" >
<input type="text" name="excelList[2].content" >
<input type="button" id="ReadingInfoSelectBtn" value="제출">
</form:form>
</body>
controller
public @ResponseBody void uploadTest(@ModelAttribute("dataForm") workExcel workExcel)
List<workExcel> workexcel = workExcel.getExcelList();
if(null != workExcel.getExcelList() && workExcel.getExcelList().size() >0 ){
for(workExcel work : workExcelList){
System.out.println(work.getContent());
}
}
}
'스프링' 카테고리의 다른 글
반응형웹과 적응형웹의 차이점은 무엇이 있나요? (0) | 2018.12.25 |
---|---|
Spring form:form 태그 설명 (0) | 2018.12.25 |
[자바]미니 블록체인 만들기 (0) | 2018.12.19 |
JSTL(JSP Standard Tag Library) Core Tag 실습 (0) | 2018.12.15 |
02.IBatis를 이용하여 DAO 작성 (0) | 2018.12.15 |