IT/SPRING

[JSTL] textarea 에서 <br> 을 \r\n 으로 바꾸기 The expression [${fn:replace(*, br, '\r\n')}] is not valid. Within a quoted String only [\], ['] and ["] may be escaped with [\].

9aram 2019. 7. 15. 16:03
반응형

java.lang.IllegalArgumentException: The expression [${fn:replace(comment.PRO_CONTN, br, '\r\n')}] is not valid.

 Within a quoted String only [\], ['] and ["] may be escaped with [\].

 

[Wrong]

<%
    //치환 변수 선언
    pageContext.setAttribute("crcn", "\r\n"); 
    pageContext.setAttribute("br", "<br>"); 
%>
<textarea name="commentDetails" rows="2">
<c:out escapeXml="false" value="${fn:replace(comment.PRO_CONTN, br, "\r\n")}"/>
</textarea>

[Right]

<%
    //치환 변수 선언
    pageContext.setAttribute("crcn", "\r\n"); 
    pageContext.setAttribute("br", "<br>"); 
%>
<textarea name="commentDetails" rows="2">
<c:out escapeXml="false" value="${fn:replace(comment.PRO_CONTN, br, crcn)}"/>
</textarea>

 

오류내용상 c태그 벨류 안에 \ 이거 사용안되는거같음 

저렇게 치환하니 ok~~

반응형