<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

 

지금까지 core 태그를 사용해왔는데 function 태그도 replace에 한해 사용해보았다.

 

사용형태:

${fn:replace(대상, ‘대상 문자열’, ‘변경할 문자열’)}

▶대상에서, 대상문자열변경할문자열로 변경

 

function, core에는 어떤 태그들이 있는지 아래 링크에 참고 가능하다.

참고 가능 사이트:

 

https://beginnersbook.com/jsp-jstl-tutorial-jstl-functions-and-core-tags/

 

JSTL functions and Core Tags- JSTL(JSP Standard Tag Lib) Tutorial

JSTL stands for JSP standard tag Library which is a collection of very useful core tags and functions. These tags and functions will help you write JSP

beginnersbook.com

 

 

https://www.javatpoint.com/jstl-function-tags

 

JSTL Function Tags - javatpoint

JSTL Function Tags for beginners and professionals with examples on JSTL core tags, function tags, formatting tags, sql tags and miscellaneous tags.

www.javatpoint.com

사용했던 방법)

 

먼저 컨트롤러에서 대상/치환 문자열들을 name설정 및 setAttribute를 해준다. (jsp에서 가져다 쓰기 위함)

 

그다음, jsp view단에서

data값을 보여줄 때 fn태그를 사용하면 된다.

▶\r\n을 <br/>로 변경한다는 뜻

즉, data의 스페이스바 엔터값들을 jsp에서 똑같이 표현해주기 위해서 br태그로 변경

+ Recent posts