我有兩個dropdownlist,一個表示月份,另一個表示日期。在java中下拉列表中的幾天的可行算法
我一個月下拉列表如下,
public Map<Integer, String> month(){
final Map<Integer, String> month = new LinkedHashMap<Integer, String>();
month.put(4,"April");
month.put(5,"May");
month.put(6,"June");
month.put(7,"July");
month.put(8,"August");
month.put(9, "September");
month.put(10,"October");
month.put(11,"November");
month.put(12,"December");
month.put(1, "January");
month.put(2,"February");
month.put(3, "March");
return monthmap;
}
天的地圖就像是
public Map<Integer, Integer> dayOfMonth(){
Map<Integer, Integer> day = new LinkedHashMap<Integer, Integer>();
//In this section feasible algorithm required.
for(int i=1;i<32;i++)
{
day.put(i,i);
}
return day;
}
基於此算法我31了每個月days.But我只需要正確的例如:「6月需要30天,在這種情況下,它有31天」。因此,我需要的是基於月份地圖,所有相應的日期應該插入到日期地圖中。
例如[(4,(1 to 30)),(5,(1 to 31)
等高達行軍] .`
我使用Java核心爲這些部分code.For UI部分的jQuery和JavaScript是used.Spring MVC是used.I很努力的技術整整一天拿到fesiable solution.Any幫助將是非常可觀.....
爲什麼您不計算月份中的#日期? – AsfK
基於我的要求,我只需要添加到一天(我的列表)作爲鍵循環中所示的關鍵值對。 – Miller