0 Replies Latest reply: Jul 7, 2011 10:07 AM by aneelkumar.boddu RSS

    Restrect the years in a calander dropdownlist  up to some years

      Hi

               i have a code like this . i am going to display this calendar in list box.  it was displaying 2011 to 2020  . i want to restrect that in the years list to 2016 current year + 5 years. if it change the next year it will display like 2017 like wise in the box. here i am getting values form a text file as map.

       

      please help to solve the issue

       

       

      Calendar calendar = Calendar.getInstance();

            request.setAttribute("DAY", calendar.get(Calendar.DATE));

            request.setAttribute("Month", calendar.get(Calendar.MONTH) + 1);

            request.setAttribute("Year", calendar.get(Calendar.YEAR));

       

            calendar.add(Calendar.DATE, +2);

            request.setAttribute("fDAY", calendar.get(Calendar.DATE));

            request.setAttribute("fMonth", calendar.get(Calendar.MONTH) + 1);

            request.setAttribute("fYear", calendar.get(Calendar.YEAR));