c 태그와 유사 하니 주의
c 태그를 쓰기위해서는 아래의 taglib를 추가해 주어야하고
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="crt" %>
글자를 자를때 쓰이는 fn 태그를 쓰려면 아래와같이 c 와 더불어 추가해주어야 한다
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="crt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
private Integer product_id;
private String product_name;
private Integer price;
private String description;
private String picture_url;
private Date regdate;
private MultipartFile file1;
productList 로 데이터를 넘겨 주었다.
fn jStl 태그를 EL 태그 에서 사용 해서 fn:length() 함수 사용. 14 글자보다 크면
substring 자른다.
<crt:forEach items="${productList}" var="row">
<crt:choose>
<crt:when test="${fn:length(row.description) > 14}">
<crt:out value="${fn:substring(row.description, 0, 50)}"/>....
</crt:when>
<crt:otherwise>
<crt:out value="${row.description}"/>
</crt:otherwise>
</crt:choose>
</crt:forEach>
댓글 ( 4)
댓글 남기기