欢迎光临
我们一直在努力

JSP日历-JSP教程,Jsp/Servlet

建站超值云服务器,限时71元/月

<%@ page contenttype="text/html; charset=gb2312" language="java" import="java.sql.*" errorpage="" %>

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

<%! string days[]; %>

<body>

<%

days=new string[42];

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

{

days[i]="";

}

%>

<%

gregoriancalendar currentday = new gregoriancalendar();

int today=currentday.get(calendar.day_of_month);

int month=currentday.get(calendar.month);

int year= currentday.get(calendar.year);

out.println(year+"年"+ (month+1)+"月"+today+"日");

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);

}

%>

<table border="0" width="168" height="81">

<div align=center>

<tr>

<th width="25" height="16" ><font color="red">日</font>

</th>

<th width="25" height="16" >一</th>

<th width="25" height="16" >二</th>

<th width="25" height="16" >三</th>

<th width="25" height="16" >四</th>

<th width="25" height="16" >五</th>

<th width="25" height="16" ><font color="red">六</font></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" valign="middle" align="center">

<%if((i-firstindex+1)==today){

%>

<font color="red"><%=days[i]%></font>

<%

} else {

%>

<%=days[i]%>

<%

}

%>

</td>

<% } %>

</tr>

<% } %>

</div>

</table>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » JSP日历-JSP教程,Jsp/Servlet
分享到: 更多 (0)

相关推荐

  • 暂无文章