From 7ae128f21d76a149e406f7547b6d25ea6453b29f Mon Sep 17 00:00:00 2001 From: hylee Date: Fri, 23 Aug 2024 17:18:58 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=82=AC=EC=9A=A9=EC=9E=90]=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=A4=EC=A0=9C=EC=9E=91=20>=20=EB=A7=9E=EC=B6=A4=EC=A0=9C?= =?UTF-8?q?=EC=9E=91=20=EC=83=98=ED=94=8C=20>=20=EB=A7=9E=EC=B6=A4?= =?UTF-8?q?=EC=A0=9C=EC=9E=91=20=EC=9A=94=EC=B2=AD=20=3D=3D>=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EA=B0=92=20=EC=98=A4=EB=A5=98=20-=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20back=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/itn/com/cmm/util/StringUtil.java | 14 ++++++++++++++ .../msgCustom/web/MjonMsgCustomWebController.java | 11 +++++++++++ .../WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp | 10 +++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/java/itn/com/cmm/util/StringUtil.java b/src/main/java/itn/com/cmm/util/StringUtil.java index 0a0e7b9b..6d093687 100644 --- a/src/main/java/itn/com/cmm/util/StringUtil.java +++ b/src/main/java/itn/com/cmm/util/StringUtil.java @@ -26,6 +26,8 @@ import java.util.Calendar; import java.util.Date; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; + public class StringUtil { private static final int HIGHEST_SPECIAL = '>'; // for escaping html code. by hessie; since 2007/10/01. @@ -600,4 +602,16 @@ public class StringUtil { } + + public static String getLengthChkAndSubString(String str, int maxLength) { + + if (StringUtils.length(str) > maxLength) { + str = StringUtils.substring(str, 0, maxLength); + // 잘라낸 문자열을 다시 설정 (필요한 경우) + } + return str; + + } + + } \ No newline at end of file diff --git a/src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java b/src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java index 70fd0fae..739b92e2 100644 --- a/src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java +++ b/src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java @@ -36,6 +36,7 @@ import itn.com.cmm.service.EgovFileMngService; import itn.com.cmm.service.EgovFileMngUtil; import itn.com.cmm.service.FileVO; import itn.com.cmm.util.DateUtils; +import itn.com.cmm.util.StringUtil; import itn.com.utl.fcc.service.EgovStringUtil; import itn.let.lett.service.HashConfVO; import itn.let.lett.service.LetterService; @@ -426,6 +427,16 @@ public class MjonMsgCustomWebController { mjonMsgCustomVO.setUserId(userId); mjonMsgCustomVO.setFrstRegisterId(userId); mjonMsgCustomVO.setLastUpdusrId(userId); + + + // 요청사항 길이 체크 + mjonMsgCustomVO.setCustomRequest( + StringUtil.getLengthChkAndSubString(mjonMsgCustomVO.getCustomRequest(), 2000) + ); + + + + mjonMsgCustomService.insertMjonMsgCustomInfo(mjonMsgCustomVO); // 법인폰 알람여부 체크 diff --git a/src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp b/src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp index 3d68708c..aea1c83a 100644 --- a/src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp +++ b/src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp @@ -65,7 +65,15 @@ $(document).ready(function(){ } }); - + // 요청사항 글자수 제한 + $("textarea[name='customRequest']").on('input paste', function() { + var maxLength = 2000; + var currentLength = $(this).val().length; + + if (currentLength > maxLength) { + $(this).val($(this).val().substring(0, maxLength)); + } + }); }); //샘플 이미지 리스트