차근차근/JAVA JSP

특정 글자수에서 줄바꿈

예쁜꽃이피었으면 2015. 8. 11. 15:32



1.

<c:forEach var="list" items="${result.career_title}">

<c:if test="${fn:length(result.career_title) > 40}">

${list} 

<br/>

</c:if>

</c:forEach>




2.

<c:forEach var="list" items="${result.career_title}">

<c:choose>

<c:when test="${fn:length(result.career_title) > 40}">${list}<br/> </c:when>

<c:otherwise>${list}</c:otherwise>

</c:choose>

</c:forEach>



제목을 DB에서 가져와서 보여주는데 너무 길어서 옆에 이미지와 겹친다.

그래서 특정 글자수가 되면 줄바꿈을 해줬다.


2는 특정글자수를 넘지 않을 경우에도 제목을 보여줘야 하기 때문에 다시 수정했다.




jstl , 줄바꿈 , 엔터 , br , 특정 글자수 , 글자길이 

반응형

'차근차근 > JAVA JSP' 카테고리의 다른 글

웹페이지 호출시 이미지 랜덤  (0) 2015.08.22
jstl 자바스크립트 db 데이터  (0) 2015.08.13
게시판만들기  (0) 2015.06.04
MySQL이클립스와 연동 설정 및 사용법  (0) 2015.06.04
TILES  (0) 2015.05.20