<%@ page language= "java" contenttype= "text/html; charset=gb2312 "%>
<%@ page language= "java" import= "java.util.*"%>
<%
String[] weekdays={"", "Day", "one", "two", "three", "four", "five", "six"};
String[] Days=new string[42];
for (int i=0;i<42;i++)
Days[i]= "";
GregorianCalendar currentday = new GregorianCalendar ();
int year= currentday.get (calendar.year);
int Month=currentday.get (calendar.month);
int Today=currentday.get (calendar.day_of_month);
int Weekday=currentday.get (Calendar.day_of_week);
String now=year+ "Year" + (month+1) + "month" +today+ "Day" + "Week" +weekdays[weekday];
Calendar thismonth=calendar.getinstance ();
Thismonth.set (Calendar.month, MONTH);
Thismonth.set (Calendar.year, year);
Thismonth.setfirstdayofweek (Calendar.sunday);
Thismonth.set (calendar.day_of_month,1);
int Firstindex=thismonth.get (Calendar.day_of_week)-1;
int Maxindex=thismonth.getactualmaximum (calendar.day_of_month);
for (int i=0;i<maxindex;i++) {
Days[firstindex+i]=string.valueof (i+1);
}
%>
<title> Simple Perpetual Calendar </title>
<link type= "Text/css" rel= "stylesheet" href= "<s2:url value= ' css/style.css '/> '" >
<script type= "Text/javascript" >
function ShowTime (showwhere) {
var now=new Date ();
var hour=now.gethours ();
var minu=now.getminutes ();
var sec=now.getseconds ();
if (hour<10) hour= "0" +hour;
if (minu<10) minu= "0" +minu;
if (sec<10) sec= "0" +SEC;
showwhere.value=hour+ ":" +minu+ ":" +SEC;
SetTimeout ("ShowTime (Time)", 1000)
}
</script>
<body onload= "ShowTime (Time)" >
<table width= "210" border= "0" align= "center" cellspacing= "1" >
<tr height= "><td colspan=" 7 "align=" center "style=" border:0 solid "><%=now%> <input type=" text "Style=" Border:0;background-color: #F9F9F9 "disable= true" id= "Time" size= "9" ></td></tr>
<tr height= "bgcolor=" "#F0F0F0" align= "Center" >
<TD style= "border:1 solid" > Day </td>
<TD style= "Border:1 solid" > </td>
<TD style= "Border:1 solid" > Two </td>
<TD style= "Border:1 solid" > Three </td>
<TD style= "Border:1 solid" > Four </td>
<TD style= "Border:1 solid" > Five </td>
<TD style= "Border:1 solid" > Six </td>
</tr>
<TR height= "4" ><td colspan= "7" ></td></tr>
<% for (int j=0;j<6;j++) {%>
<tr>
<%
for (int i=j*7;i< (j+1) *7;i++) {
if ((i-firstindex+1) ==today) {%>
<TD width= "height=" align= "center" bgcolor= "Gray" style= "border:1 solid" ><font color= "#FFFFFF" > <b><%=days[i]%></b></font></td>
<%}else{%>
<TD width= "height=" align= "center" style= "border:1 solid" ><%=days[i]%></td>
<%}
}%>
</tr>
<%}%>
<TR height= "Ten" ><td colspan= "7" ></td></tr>
</table>
</body>
gets the month in the Calendar wrapper class, using the calendar. Day_of_month gets the first one months of the current month