From a10896d5349cb72c6478a58425f81d663578b428 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 24 Jul 2023 11:06:55 +0900 Subject: [PATCH] =?UTF-8?q?HTML=EC=97=94=ED=8B=B0=ED=8B=B0=20=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=EC=BD=94=EB=93=9C=20=EC=B9=98=ED=99=98=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/fims/crdn/crdn01050-info.jsp | 10 +++++-- .../js/fims/framework/cmm/cmmUtil.js | 28 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01050-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01050-info.jsp index 1d247ca4..7dc755bc 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01050-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01050-info.jsp @@ -140,7 +140,10 @@ $(document).ready(function() { Accept: "application/json; charset=utf-8" }, success : resp => { - $P.cvlcptControl.setData([resp.cvlcptInfo]); + var cvlcptInfo = resp.cvlcptInfo; + cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN); + $P.cvlcptControl.setData([cvlcptInfo]); + var cs = $P.parentRes.getCountStatus($("#crdnId--${pageName}").val()); $("#countStauts--${pageName}").val(cs); $P.parentRes.selectRow(crdnId); @@ -157,8 +160,9 @@ $(document).ready(function() { /************************************************************************** * 초기화 **************************************************************************/ - $P.cvlcptControl.setData([${cvlcptInfo}]); - + var cvlcptInfo = ${cvlcptInfo}; + cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN); + $P.cvlcptControl.setData([cvlcptInfo]); var cs = $P.parentRes.getCountStatus($("#crdnId--${pageName}").val()); $("#countStauts--${pageName}").val(cs); }); diff --git a/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js b/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js index ed4569e1..26bb7162 100644 --- a/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js +++ b/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js @@ -223,7 +223,27 @@ function getByte(str) { return size; }; - - - - +/** + * HTML 엔티티 문자코드를 특수문자로 치환한다. + * @return 치환된 문자열 + */ +function escapeHTMLEntity(str) { + if(str == undefined || str == null){ + return "" + } + + var regex = /&(amp|lt|gt|quot|#39);/g; + var chars = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + if(regex.test(str)) { + return str.replace(regex, (matched) => chars[matched] || matched); + } else { + return str; + } +}