String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
My JSP 'index.jsp' starting pageint alldays=0;//变量alldays记录本月的天数;
%>
SimpleDateFormat format1=new SimpleDateFormat("MM");
SimpleDateFormat format2=new SimpleDateFormat("dd");
String str=format.format(date);//获取日期格式为:2018年03月15日;
String mm=format1.format(date);//获取 月;
String dd=format2.format(date);//获取 天;
Calendar date1=Calendar.getInstance();
int weekday=date1.get(Calendar.DAY_OF_WEEK_IN_MONTH)+1;
int firstweek=date1.get(Calendar.DAY_OF_WEEK);//获取本月第一天星期几;
int td=Integer.valueOf(dd)%7;
%>
alldays=31;
}
else if(mm.equals("02")){
alldays=29;
}
else{
alldays=30;
}
%>
int flagdate=1;
int a[][]=new int[5][7];
//int j=0,k=0;
for(int j=0;j<5;j++){
for(int k=0;k<7;k++){
if(j==0&&k
a[j][k]=0;
}
else{
if(flagdate
a[j][k]=flagdate;
flagdate++;
}
}
}
}
%>
%>
}%>
for(int j=0;j<5;j++){
%>
for(int k=0;k<7;k++){
if(a[j][k]!=0){
if(a[j][k]==Integer.valueOf(dd)){
%>
continue;
}
%>
a[j][k]
%>
}
else{
%>
}
}
%>
}
%>