Struts + js日期选择源码

Struts + js日期选择源码

Web页面里,日期选择是一个很头疼的问题,闰年,平年,大月小月,是一个三级的联动下拉选单,这里我用的是JavaScript的解决方案

 

下面是代码

 

<%

                  Vector yearCollection = new Vector();

                  for (int i = new GregorianCalendar().get(GregorianCalendar.YEAR); i >= 1900; --i) {

                      yearCollection.add(new org.apache.struts.util.LabelValueBean(String.valueOf(i), String.valueOf(i)));

                  }

                  java.util.Vector monthCollection = new java.util.Vector();

                  for (int i = 1; i <= 12; ++i) {

                      monthCollection.add(new org.apache.struts.util.LabelValueBean(String.valueOf(i), String.valueOf(i)));

                  }

                  pageContext.setAttribute("yearCollection", yearCollection);

                  pageContext.setAttribute("monthCollection", monthCollection);

                %>

 

                "sendYear" οnchange="toDate()" styleId="year">

Identifier to be assigned to this HTML element (renders an "id" attribute). -->

                  "yearCollection" property="value" labelProperty="label"/>

               

                "sendMonth" οnchange="toDate()" styleId="month">

                "monthCollection" property="value" labelProperty="label"/>

               

                "sendDay" οnchange="toDay()" styleId="day">

               

               

               

你可能感兴趣的:(开源框架)