<! -- File name: Calendar. jsp -->
<! -- Display the calendar of any year or month. You can select a different year or month. Author: Wildfield -->
<% @ Page Language = "Java" Import = "Java. util. *" %>
<%! String year;
String month;
%>
<% Month = request. getparameter ("month ");
Year = request. getparameter ("year ");
%>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> day </title>
<Script language = "JavaScript">
<! --
Function changemonth ()
{
VaR Mm = "calendar. jsp? Month = "+ document. Sm. elements [0]. selectedindex +" & year ="
+ <% = Year %>;
Window. Open (Mm, "_ Self ");
}
// --> </SCRIPT>
</Head>
<%! String days []; %>
<%
Days = new string [42];
For (INT I = 0; I <42; I ++)
{
Days = "";
}
%>
<%
Calendar thismonth = calendar. getinstance ();
If (month! = NULL &&(! Month. Equals ("null ")))
Thismonth. Set (calendar. Month, integer. parseint (month ));
If (year! = NULL &&(! Year. Equals ("null ")))
Thismonth. Set (calendar. Year, integer. parseint (year ));
Year = string. valueof (thismonth. Get (calendar. Year ));
Month = string. valueof (thismonth. Get (calendar. month ));
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 );
}
%>
<Body>
<Form name = "SM" method = "Post" Action = "calendar. jsp">
<% = Year %> year <% = integer. parseint (month) + 1%> month
<Table border = "0" width = "168" Height = "81">
<Div align = center>
<Tr>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> <font color = "red"> day </font>
</Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> 1 </Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> 2 </Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> 3 </Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> 4 </Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> 5 </Th>
<TH width = "25" Height = "16" bgcolor = "# FFFF00"> <font color = "green"> 6 </Fon
T> </Th>
</Tr>
<% For (Int J = 0; j <6; j ++) {%>
<Tr>
<% For (INT I = J * 7; I <(J + 1) * 7; I ++) {%>
<TD width = "15%" Height = "16" bgcolor = "# c0c0c0" valign = "Middle" align = "CE
Nter ">
<A href = "Jump. jsp? Year = <% = year %> & month = <% = integer. parseint (month) + 1%> & D
Ate = <% = days [I] %> "target =" Main "> <% = days [I] %> </a> </TD>
<% }%>
</Tr>
<% }%>
</Div>
</Table>
<Table border = "0" width = "168" Height = "20">
<Tr>
<TD width = 30%> <select name = "month" size = "1" onchange = "changemonth ()">
<Option value = "0"> August 1, January </option>
<Option value = "1"> April February </option>
<Option value = "2"> August 1, March </option>
<Option value = "3"> August 1, April </option>
<Option value = "4"> August 1, May </option>
<Option value = "5"> August 1, June </option>
<Option value = "6"> August 1, July </option>
<Option value = "7"> August 1, August </option>
<Option value = "8"> August 1, September </option>
<Option value = "9"> October </option>
<Option value = "10"> November </option>
<Option value = "11"> August 1, December </option>
</SELECT> </TD>
<TD width = 28%> <input type = text name = "year" value = <% = year %> size = 4 maxlength
= 4> </TD>
<TD> year </TD>
<TD width = 28%> <input type = submit value = "Submit"> </TD>
</Tr>
</Table>
</Form>
<Script language = "JavaScript">
<! --
Document. Sm. Month. Options. selectedindex = <% = month %>;
// -->
</SCRIPT>
</Body>
</Html>