想请教大家要怎样用ecside table实现月历
|
afacd
2007-02-07
想请教大家要怎样用ecside table实现小月历
就是假设我要秀096/01/01~096/01/31 我先判断星期几後,然後抓5~7位的日期放到日、或1 2 3 4 5 6 然後在ecside table 上秀出一月的月历 但怎样弄都弄不好,故想跟大家讨论下 我是判断星期几後,把日期放在他应该属於的星期期(map) 最後存在ArrayList presidents = new ArrayList(); 丢到jsp上,秀出小月历 我困扰的是要怎样分行,一到星期日就要换下一行 若没有的天数,要保持空白,谢谢
Map president = new HashMap();
for ( int i=0; i< ro_multeity.size(); i++){
System.out.println("i=" +i);
//判断星期几
int yyyy = Integer.parseInt(startyear)+ 1911;
int mm = Integer.parseInt(startmonth);
int dd = Integer.parseInt(startday);
int tm = (mm >= 3) ? (mm - 2):(mm + 10);
int ty = (mm >= 3) ? yyyy : (yyyy - 1);
int td = (ty + ty / 4 - ty / 100 + ty / 400 + (int)(2.6 * tm - 0.2) + dd) % 7;
if (td==0){
president.put("日", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}else{
if (td==1){
president.put("一", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (td==2){
president.put("二", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (td==3){
president.put("三", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (td==4){
president.put("四", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (td==5){
president.put("五", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (td==6){
president.put("六", ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
}
presidents.add(president);
}
|
|
|
afacd
2007-02-08
终於解决了,方法虽然不好,但能用ecside实现某月的日历= =
这是客户最近要的假日档查询,想说用日历的方式呈现 放进ecside还是比较快完成这个功能
Map president = new HashMap();
for ( int i=0; i< ro_multeity.size(); i++){
//判断星期几
int yyyy = Integer.parseInt(startyear)+ 1911;
int mm = Integer.parseInt(startmonth);
int dd = Integer.parseInt(((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
int tm = (mm >= 3) ? (mm - 2):(mm + 10);
int ty = (mm >= 3) ? yyyy : (yyyy - 1);
int td = (ty + ty / 4 - ty / 100 + ty / 400 + (int)(2.6 * tm - 0.2) + dd) % 7;
if (td==0){
//星期天的时候才存进List presidents里面
president.put( String.valueOf(td), ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
presidents.add(president);
president = new HashMap();
}else{
president.put( String.valueOf(td), ((PCEM13_Bean) ro_multeity.get(i)).getCFDAY().substring(5,7));
}
if (dd ==(ro_multeity.size())){
//把最後一周存的存进List presidents里面
presidents.add(president);
}
}
jsp <ec:row> <ec:column property="1" title="一" style="text-align:center"/> <ec:column property="2" title="二" style="text-align:center"/> <ec:column property="3" title="三" style="text-align:center"/> <ec:column property="4" title="四" style="text-align:center"/> <ec:column property="5" title="五" style="text-align:center"/> <ec:column property="6" title="六" style="text-align:center;color:red"/> <ec:column property="0" title="日" style="text-align:center;color:red"/> </ec:row> |
|
|
fins
2007-02-09
谢谢你提供的代码
以后我要做类似功能 看来也可以用ec了 :) 你扩展了我的思路 谢谢 |

