JSP

 

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>  

 

 

about author

PHRASE

Level 60  머나먼나라

부모가 나를 완전한 몸으로 낳아 주셨다. 자식된 나도 그 몸을 완전하게 보전하여 부 모에게 돌려주어야 한다. 이것이 효도라고 하는 것이다. 공자가 한 말. -예기

댓글 ( 4)

댓글 남기기

작성