jspParent 안에 jspChild를 붙여넣는 방법
1. jspParent
<script>
function postJsp(){
jQuery.ajax({
url : 컨트롤러URL,
type : 'post',
dataType : 'html',
success : function(data){
jQuery("#contents").html(data);
},
error:function(request, status, error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
)};
}
</script>
...
<div id="contents"></div>
...
2.controller
@RequestMapping(value = "컨트롤러 URL")
public String postJspChild(..., ModelMap model){
model.addAttribute("greet","hello");
return "jsp/...jspChild의 경로";
}
3.jspChild
<script>
jQuery(document).ready(function(){
alert('${greet}'); //'hello'
});
</script>
4.jspChild에서 jspParent의 함수 등에 접근 할 수 있다.
'개발' 카테고리의 다른 글
mysql pk컬럼 해제하는 법 (0) | 2020.12.19 |
---|---|
mysql limit (0) | 2020.12.19 |
<c:choose> 쓸 때 서버에러 난다면 (0) | 2020.12.19 |
intelliJ 단축키 - 윈도우,맥 (0) | 2020.12.19 |
오라클, mysql 커밋 차이점 (0) | 2020.12.19 |