본문 바로가기

팁???

살짝 캘린더 팁

<div align="center">

 

<table border="1">

<col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100">

 

<tr height="100">

<td colspan="7" align="center" style="padding-top: 20px">

<%=pp %>&nbsp;&nbsp;<%=p %>&nbsp;

 

<font color="black" style="font-size: 50px">

<%=String.format("%d년&nbsp;&nbsp;%d월", year , month) %>

</font>

 

<%=n %>&nbsp;&nbsp;<%=nn %>&nbsp;

 

</td>

</tr>

 

<tr height="50">

<th align="center"></th>

<th align="center"></th>

<th align="center"></th>

<th align="center"></th>

<th align="center"></th>

<th align="center"></th>

<th align="center"></th>

</tr>

 

<tr height="100" align="left" valign="top">

<%

//위쪽 빈칸

for(int i = 1; i < dayOfWeek; i++){

%>

<td style="background-color: #cecece">&nbsp;</td>

<%

}

 

//날짜

int lastday = cal.getActualMaximum(Calendar.DAY_OF_MONTH);

for(int i = 1; i <= lastday; i++){

%>

<td>

<%=UtilEx.callist(year, month, i) %>&nbsp;&nbsp;<%=UtilEx.showPen(year, month, i) %>

<%=UtilEx.makeTable(year, month, i, list) %>

</td>

<%

if( (i + dayOfWeek - 1) % 7 == 0 && i != lastday){ // && 뒤에 있는 부분이 마지막날짜면 바로 끝내게 해주는 것 안해주면 한열 더생김

%>

</tr><tr height="100" align="left" valign="top">

 

 

<%

}

}

%>

 

 

 

<%-- 밑에 빈칸 --%>

<%

cal.set(Calendar.DATE, lastday); // 그 달의 마지막 날짜로 세팅

 

int weekday = cal.get(Calendar.DAY_OF_WEEK);

for(int i = 0 ; i < 7 - weekday; i ++){

//아래 코드는 빈칸 색깔코드

%>

 

<td style="background-color: #cecece">&nbsp;</td>

<%

}

%>

 

 

</tr>

 

</table>

 

</div>