|
Space Map
|
JSTL과 Velocity를 활용한 UI 레이어 구현 방법Table of ContentsJSTL소개
설치 방법
사용 예(기본 문법)
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html 참고
<c:set var="num1" value="${20}" />
<c:set var="num2">
10.5
</c:set>
<c:set var="today" value="<%= new java.util.Date()%>" /><br>
변수 num1 = ${num1} <br>
변수 num2 = ${num2} <br>
num1 + num2 = ${num1+num2}<br>
오늘은 ${today}입니다.
<c:remove var="num1" scope="page" />
<p>
삭제한 후의 num1=${num1} <br>
삭제한 후의 num1 + num2 = ${num1 + num2}
<c:catch var="myException">
It's catch
<% int x = 10/0; %>
실행안됨.
</c:catch>
<c:if test="${myException != null}">
발생된 예외는 : ${myException.message} <br>
</c:if>
<c:import url="Header.jsp" >
<c:param name="subTitle" value="This is subTitle"/>
</c:import>
<c:choose>
<c:when test="${param.name == 'bk' }">
<li>당신의 이름은 ${param.name}입니다.
</c:when>
<c:when test="${param.age > 18 }">
<li>당신은 18세 이상입니다.
</c:when>
<c:otherwise>
<li> 당신은 'bk'가 아니고 18세 이상이 아닙니다.
</c:otherwise>
</c:choose>
forEach : <c:forEach var="변수" items="아이템" begin="시작값" end="끝값" step="증가값">
<c:forEach var="i" begin="1" end="9">
<li>4 *${i} = ${4 *i}
</c:forEach>
<h4>int 형 배열</h4>
<c:forEach var="i" items="${intArray}" begin="2" end="4">
[${i}]
</c:forEach>
<h4>Map</h4>
<c:forEach var="i" items="${map}">
${i.key} = ${i.value}<br>
</c:forEach>
<c:forEach var="member" items="${memberList}" varStatus="memberLoopCount">
회원 $(memberLoopCount.count} : ${member} <br>
</c:forEach>
forTokens : <c:forTockens var="token" items="문자열" delins="구분자">
<c:forTokens var="token" items="빨강색, 주황색, 노란색, 초록색, 파랑색, 남색, 보라색" delims=",">
${token}<br>
</c:forTokens>
formatNumber : 숫자 형식을 표현
number : <fmt:formatNumber value="9876543.61" type="number"/>
currency: <fmt:formatNumber value="9876543.61" type="currency"/>
percent : <fmt:formatNumber type="percent">9876543.61</fmt:formatNumber>
pattern=".000" :<fmt:formatNumber value="9876543.61" pattern=".000" />
pattern="#,#00.0#":<fmt:formatNumber value="9876543.612345" pattern="#,#00.0#"/>
parseNumber : 정해진 패턴을 문자열에서 수치를 파싱해내는 태그
<jsp:useBean id="now" class="java.util.Date"/>
<c:out value="${now}"/>
date: <fmt:formatDate value="${now}" type="date"/>
time: <fmt:formatDate value="${now}" type="time"/>
both: <fmt:formatDate value="${now}" type="both"/>
default:<fmt:formatDate value="${now}"
type="both" dateStyle="default" timeStyle="default"/>
short :<fmt:formatDate value="${now}"
type="both" dateStyle="short" timeStyle="short" />
medium :<fmt:formatDate value="${now}"
type="both" dateStyle="medium" timeStyle="medium" />
long :<fmt:formatDate value="${now}"
type="both" dateStyle="long" timeStyle="long" />
full :<fmt:formatDate value="${now}"
type="both" dateStyle="full" timeStyle="full" />
pattern="yyyy년MM월dd일 HH시mm분ss초"
<fmt:formatDate value="${now}" type="both"
pattern="yyyy년MM월dd일 HH시mm분ss초"/>
<fmt:formatDate value="${now}" pattern="yyyy/MM/dd" />
parseDate :정해진 패턴의 문자열에서 날짜를 파싱해내는 태그 setTimeZone : <fmt:timeZone value="" var="" scope=""/>
<sql:update>
VelocityVelocity 소개
설치 방법
사용 예(기본 문법)Velocity Template Language(VTL) 은 Template 에서 사용되는 Velocity 고유의 언어를 의미합니다.
##This is an example velocity template
#set($this = "Velocity")
$this is great! But It's so hard.
#foreach($name in $list)
$name is great!
#end
#set($condition = true)
#if ($condition)
The condition is true!
#else
The condition is false
#end
http://jakarta.apache.org/velocity/docs/vtl-reference-guide.html Tool box 에 대해VelocityTools is a collection of Velocity subprojects with a common goal of creating tools and infrastructure for building both web and non-web applications using the Velocity template engine.
JSTL 과 Velocity같은 로직에 대해 두가지를 사용하여 각각 구현 다양한 View Technology에 대한 실행 속도 비교.현재 개발중 우리들이 많이 사용하는 View 기술들을 이용하여 실행속도를 비교해 보면 다음 그래프와 같다.
![]() 위와 같이 테스트를 진행한 결과 JSP는 초당 54페이지, Velocity는 초당 112페이지, XMLC는 초당 128 페이지, XSLT는 6,7페이지를 서비스하였다. 이 부분에서 눈여겨 볼 부분은 Velocity에 대한 결과라할 수 있다. 국내에서는 아직까지 많이 사용되지 않는 기술이지만 위의 실행 결과를 보면 사용할만한 가치가 있다는 것을 확인할 수 있다. 참고문헌문서에 대하여최초작성자 : 박재성
|
|

Comments (5)
9월 23, 2005
Anonymous says:
velocity 좋군요..velocity 좋군요..
10월 18, 2005
장회수 says:
몰라서리.. test몰라서리.. test
11월 01, 2005
Jang Jooran says:
언니~~ 기대 만땅~~ ^^언니~~ 기대 만땅~~ ^^
11월 01, 2005
박재성 says:
me toome too
1월 09, 2006
Anonymous says:
아니 저사람은 누군데... 왜 하필... 내 발표자료에 이런짓을 자꾸 하는 거져... ㅠㅠ 속상하게... – 수영 -아니 저사람은 누군데...
왜 하필... 내 발표자료에 이런짓을 자꾸 하는 거져... ㅠㅠ
속상하게... –