用JSP实现的一个日历程序

 

 

  String month; 

%> 

  year =request.getParameter("year"); 

%> 

 

 

 

日 

 

 

 

days=new String[42]; 

for(int i=0;i { 

  days[i]=""; 

 } 

%> 

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 { 

  days[firstIndex+i]=String.valueOf(i+1); 

 } 

%> 

 

 

  年  月 

 

 

  

   

日 

 

   一 

   二 

   三 

   四 

   五 

   六 

t> 

  

 

 

      

    nter"> 

    &month=&d 

ate=" target="main">

 

    

  

 

 

 

 

 

  

   一月 

   二月 

   三月 

   四月 

   五月 

   六月 

   七月 

   八月 

   九月 

   十月 

   十一月 

   十二月 

  

 size=4 maxlength 

=4> 

年 

 

 

 

 

 

 

   

相关文章

HashMap是Java中最常用的集合类框架,也是Java语言中非常典型...
在EffectiveJava中的第 36条中建议 用 EnumSet 替代位字段,...
介绍 注解是JDK1.5版本开始引入的一个特性,用于对代码进行说...
介绍 LinkedList同时实现了List接口和Deque接口,也就是说它...
介绍 TreeSet和TreeMap在Java里有着相同的实现,前者仅仅是对...
HashMap为什么线程不安全 put的不安全 由于多线程对HashMap进...