Displaying all the months of the year

I have created a calendar program in jsp. But it only shows the current month 12 times,rather than displaying all the months. When the user enters the year, i want to display all the 12 months.

Here is the code for the calendar :

<%@page import="java.util.*,java.text.*" %>

<html>

<head>

<title>Print a month page.</title>

<meta name="version"

></head>

<body bgcolor="white">

<%

boolean yyok =false;

int yy = 0, mm = 0;

String yyString = request.getParameter("year");

if (yyString !=null && yyString.length( ) > 0)

{

try{

yy = Integer.parseInt(yyString);

yyok =true;

}

catch (NumberFormatException e)

{

out.println("Year " + yyString +" invalid");

}

}

Calendar c = Calendar.getInstance( );

if (!yyok)

yy = c.get(Calendar.YEAR);

mm = c.get(Calendar.MONTH);

for (int i=0; i<months.length; i++)

{

mm = i;

break;

}

%>

<form method=post action="CalendarPage.jsp">

Enter Year :

<input type="text" size="5" name="year" value=" <%= yy %>"></input>

<input type=submit value="Display">

</form>

<%!

String[] months =

{

"January","February","March","April",

"May","June","July","August",

"September","October","November","December"

};

int dom[] ={

31, 28, 31, 30,

31, 30, 31, 31,

30, 31, 30, 31

};

%>

<%

int leadGap = 0;

%>

<table border=1>

<tr>

<th colspan=7>

<%= months[mm] %>

<%= yy %>

</tr>

<%

GregorianCalendar calendar =new GregorianCalendar(yy, mm, 1);

for(int j=1;j<=12;j++)

{

%>

<tr><td>Sunday<td>Monday<td>Tuesday<td>Wednesday<td>Thursday<td>Friday<td>Saturday</tr>

<%

leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;

int daysInMonth = dom[mm];

if (calendar.isLeapYear(calendar.get(Calendar.YEAR)) && mm == 1)

++daysInMonth;

out.print("<tr>");

out.println(" ");

for (int i = 0; i < leadGap; i++)

{

out.print("<td>&nbsp;");

}

for (int i = 1; i <= daysInMonth; i++)

{

out.print("<td>");

out.print(i);

out.print("</td>");

if ((leadGap + i) % 7 == 0)

{

out.println("</tr>");

out.print("<tr>");

}

}

}

%>

</tr>

</table>

</html>

please check the code and correct my mistake..

Thanks in Advance,

Venkatesh.P

[4991 byte] By [venkateshpa] at [2007-10-2 12:36:51]
# 1
I have bills to pay. Please send money or pay the bills.Thanks in advance.
MartinHilperta at 2007-7-13 9:38:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
See for example Annual calendar taglib in Coldtags suite: http://www.servletsuite.com/jsp.htm
dnamiota at 2007-7-13 9:38:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

hai every one

i need same requirement like dispaly the all the months of the year but i need each and every date should be an hyperlink if i click any day it should ask for the cinfirmation "you need to set the day as holiday" then if you select ok then that day would be an redcolour backround and add tooltip for that day.

AND if i select defined holiday then if should ask confirmation "you need to set holiday as working day "

AND

list all the holidays of the perticular year

this is my requirement

please help me this code how can i do this in jsp

this is urgent work to do

regards

satish

satishrspla at 2007-7-13 9:38:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...