<s: taglib에서 jsp에서 선언한 변수와 비교할 수 있는 방법
글쓴이: plus0204 / 작성시간: 목, 2014/08/28 - 10:23오전
안녕하세요.
struts를 잘 몰라서 질문드립니다.
DB에서 가져온 날짜와 JSP에서 현재 날짜를 구해서 종료일시가 지났는지를 비교하고 싶은데
s:if test="%{edate.substring(0,8) < strDate }" 부분을 어떻게 코딩해야 하는지 모르겠네요.
- edate : db에서 가져온 데이터. 데이터형식(string) : 201401012359
- strDate : jsp에서 선언한 변수. 현재 날짜를 가지고 있음. 데이터형식(string) : 20140101
s taglib에서 jsp에서 선언한 변수와 비교할 수 있는 방법이 있는 지 알고 싶습니다.
jsp 부분에서 해결할 수 있는 방법이 있으면 알려주시면 감사하겠습니다.
<% DecimalFormat df = new DecimalFormat("00"); Calendar currentCalendar = Calendar.getInstance(); //현재 날짜 구하기 String strYear = Integer.toString(currentCalendar.get(Calendar.YEAR)); String strMonth = df.format(currentCalendar.get(Calendar.MONTH) + 1); String strDay = df.format(currentCalendar.get(Calendar.DATE)); String strDate = strYear + strMonth + strDay; %> <s:iterator value="%{QuestionVOList}"> // 날짜 비교 부분. edate = 201401012359 형식 // 종료일시가 현재 날짜(strDate)를 지났는지 비교 <s:if test="%{edate.substring(0,8) < strDate }"> // 처리부분 </s:if> </s:iterator>
Forums:
댓글 달기