일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- sencha touch
- rowspan
- JDOM
- Struts
- jsr 296
- dock
- node.js
- Android
- phonegap
- GPS
- Google Map
- ibsheet
- PLSQL
- Eclipse
- Ajax
- WebLogic
- 선택적조인
- appspresso
- Spring
- iBATIS
- jQuery
- tomcat
- oracle
- 가우스
- JSON
- swingx
- 전자정부프레임워크
- MySQL
- MFC
- PHP
- Today
- Total
Where The Streets Have No Name
달력출력 본문
http://www.okjsp.pe.kr/bbs?act=VIEW&bbs=bbs4&seq=43722
<%@ page language="java" pageEncoding="EUC-KR" %>
<%@ page import="java.util.*,com.dkey.util.ParamUtil" %>
<%
Calendar today = Calendar.getInstance();
Calendar firstday = Calendar.getInstance();
Calendar lastday = Calendar.getInstance();
int toYear = ParamUtil.getIntParameter(request.getParameter("year"),today.get(Calendar.YEAR));
int toMonth = ParamUtil.getIntParameter(request.getParameter("month"),today.get(Calendar.MONTH)+1);
out.println("<center>"+toYear +"/"+ toMonth+"</center><br>");
firstday.set(toYear,toMonth-1,1);
lastday.set(toYear,toMonth,1);
lastday.add(Calendar.DATE,-1); //해당월의 마지막 날짜
%>
<html>
<head>
<title>Calendar</title>
</head>
<body bgcolor="#FFFFFF">
<table border=1 width=90% align=center>
<tr height=30 align=center bgcolor=#929292>
<td><font color=red><b>일</b></font></td>
<td>월</td>
<td>화</td>
<td>수</td>
<td>목</td>
<td>금</td>
<td><font color=blue><b>토</b></font></td>
</tr>
<%
int jcount = (int)Math.ceil((double)(lastday.get(Calendar.DATE)-1 + firstday.get(Calendar.DAY_OF_WEEK)) / 7);
int count = 2; // 첫번째 요일까지 공백 때분에...
int _day = 0;
String bgcolor = "";
for(int ju=0;ju<jcount;ju++){
out.println("<tr>");
for(int i=0;i<7;i++){
switch(i){
case 0 : bgcolor="#FFD7D7";break;
case 6 : bgcolor="#C1C1FF";break;
default : bgcolor="#E7E7E7";break;
}
if(firstday.get(Calendar.DAY_OF_WEEK) < count){
_day = count - firstday.get(Calendar.DAY_OF_WEEK);
if( _day > lastday.get(Calendar.DATE)) _day = 0;
}
count ++;
out.println("<td height=100 valign=top bgcolor='"+bgcolor+"'>"+_day+"</td>");
}
out.println("</tr>");
}
%>
</body>
</html>