posts - 40,  comments - 187,  trackbacks - 0
          1. 目的:動(dòng)態(tài)設(shè)置時(shí)間,觸發(fā)相應(yīng)的任務(wù)

          2. 系統(tǒng)架構(gòu)為 struts + spring + hibernate

          3. 實(shí)現(xiàn)步驟:
          • 在頁面上設(shè)置時(shí)間;
          • 將時(shí)間轉(zhuǎn)換為Unix Cron Expression;
          • 將轉(zhuǎn)換后的時(shí)間規(guī)則表達(dá)式記錄到數(shù)據(jù)庫中(也可以寫入xml文件中,這里是項(xiàng)目需要記錄入數(shù)據(jù)庫中);
          • 從數(shù)據(jù)庫中得到相應(yīng)的時(shí)間規(guī)則表達(dá)式;
          • 更新您的任務(wù)觸發(fā)器的時(shí)間設(shè)置;
          • RESCHEDULE THE JOB。; - )

          4. 具體實(shí)現(xiàn)細(xì)節(jié):

          1) 在頁面上設(shè)置時(shí)間
          根據(jù)具體的業(yè)務(wù)需求,設(shè)置時(shí)間規(guī)則,下面以某一項(xiàng)目為例,需要 按每月、每周、自定義分為三種規(guī)則。
          ?1 < tr >
          ?2 ?????????? < th > 執(zhí)行這個(gè)任務(wù) </ th >
          ?3 ?????????? < td? style ="font-weight:bold;" >
          ?4 ??????????? < html:radio? property ="everyWhat" ?styleClass ="InputBorderNone" ?value ="monthly" ?onclick ="changeStatus(this.value)" > 每月 </ html:radio >
          ?5 ??????????? < html:radio? property ="everyWhat" ?styleClass ="InputBorderNone" ?value ="weekly" ?onclick ="changeStatus(this.value)" > 每周 </ html:radio >
          ?6 ??????????? < html:radio? property ="everyWhat" ?styleClass ="InputBorderNone" ?value ="userDefined" ?onclick ="changeStatus(this.value)" > 自定義 </ html:radio >
          ?7 ??????????? < html:hidden? property ="jobName" ?value ="compare" ? />
          ?8 ?????????? </ td >
          ?9 </ tr >
          10

          每月則需要選擇該月的第幾個(gè)星期的星期幾
          ?1 < tr? style ="display:" ?id ="whichWeek" >
          ?2 ?????????? < th > 選擇第幾個(gè)星期 </ th >
          ?3 ?????????? < td? style ="font-weight:bold;" >
          ?4 ??????????? < html:select? property ="week" >
          ?5 ???????????? < html:option? value ="1" > </ html:option >
          ?6 ???????????? < html:option? value ="2" > </ html:option >
          ?7 ???????????? < html:option? value ="3" > </ html:option >
          ?8 ???????????? < html:option? value ="4" > </ html:option >
          ?9 ??????????? </ html:select >
          10 ??????????? < html:select? property ="dayOfMonth" >
          11 ???????????? < html:option? value ="1" > 星期日 </ html:option >
          12 ???????????? < html:option? value ="2" > 星期一 </ html:option >
          13 ???????????? < html:option? value ="3" > 星期二 </ html:option >
          14 ???????????? < html:option? value ="4" > 星期三 </ html:option >
          15 ???????????? < html:option? value ="5" > 星期四 </ html:option >
          16 ???????????? < html:option? value ="6" > 星期五 </ html:option >
          17 ???????????? < html:option? value ="7" > 星期六 </ html:option >
          18 ??????????? </ html:select >
          19 ??????? ? </ td > ?
          20 ? </ tr >
          21

          每周則需要選擇星期幾
          ?1 < tr? style ="display:none" ?id ="whichDay" >
          ?2 ?????????? < th > 選擇星期 </ th >
          ?3 ?????????? < td? style ="font-weight:bold;" >
          ?4 ??????????? < html:select? property ="dayOfWeek" >
          ?5 ???????????? < html:option? value ="1" > 星期日 </ html:option >
          ?6 ???????????? < html:option? value ="2" > 星期一 </ html:option >
          ?7 ???????????? < html:option? value ="3" > 星期二 </ html:option >
          ?8 ???????????? < html:option? value ="4" > 星期三 </ html:option >
          ?9 ???????????? < html:option? value ="5" > 星期四 </ html:option >
          10 ???????????? < html:option? value ="6" > 星期五 </ html:option >
          11 ???????????? < html:option? value ="7" > 星期六 </ html:option >
          12 ??????????? </ html:select >
          13 ???????? </ td > ?
          14??? </ tr >
          15

          自定義則選擇具體的日期,如 2007-1-10

          三種規(guī)則都需要設(shè)定時(shí)間點(diǎn)
          ?1 < tr >
          ?2 ?????????? < th > 起始時(shí)間 </ th >
          ?3 ?????????? < td? style ="font-weight:bold;" >
          ?4 ??????????? < html:select? property ="timeType" ?styleId ="type" ?onchange ="changeStatus2(this.value)" >
          ?5 ???????????? < html:option? value ="AM" > 上午 </ html:option >
          ?6 ???????????? < html:option? value ="PM" > 下午 </ html:option >
          ?7 ??????????? </ html:select >
          ?8 ??????????? < html:select? property ="hour" ?styleId ="amHours" >
          ?9 ???????????? < html:option? value ="1" > 1 </ html:option >
          10 ???????????? < html:option? value ="2" > 2 </ html:option >
          11 ???????????? < html:option? value ="3" > 3 </ html:option >
          12 ???????????? < html:option? value ="4" > 4 </ html:option >
          13 ???????????? < html:option? value ="5" > 5 </ html:option >
          14 ???????????? < html:option? value ="6" > 6 </ html:option >
          15 ???????????? < html:option? value ="7" > 7 </ html:option >
          16 ???????????? < html:option? value ="8" > 8 </ html:option >
          17 ???????????? < html:option? value ="9" > 9 </ html:option >
          18 ???????????? < html:option? value ="10" > 10 </ html:option >
          19 ???????????? < html:option? value ="11" > 11 </ html:option >
          20 ???????????? < html:option? value ="12" > 12 </ html:option >
          21 ??????????? </ html:select >
          22 ??????????? < html:select? property ="hour" ?styleId ="pmHours" ?style ="display:none" >
          23 ???????????? < html:option? value ="13" > 13 </ html:option >
          24 ???????????? < html:option? value ="14" > 14 </ html:option >
          25 ???????????? < html:option? value ="15" > 15 </ html:option >
          26 ???????????? < html:option? value ="16" > 16 </ html:option >
          27 ???????????? < html:option? value ="17" > 17 </ html:option >
          28 ???????????? < html:option? value ="18" > 18 </ html:option >
          29 ???????????? < html:option? value ="19" > 19 </ html:option >
          30 ???????????? < html:option? value ="20" > 20 </ html:option >
          31 ???????????? < html:option? value ="21" > 21 </ html:option >
          32 ???????????? < html:option? value ="22" > 22 </ html:option >
          33 ???????????? < html:option? value ="23" > 23 </ html:option >
          34 ???????????? < html:option? value ="0" > 0 </ html:option >
          35 ??????????? </ html:select > ?點(diǎn)
          36 ???????????? < html:text? property ="minute" ?name ="minute" ?style ="width:20px;" ?value ="0" ?onchange ="valTime(this.value)" ? /> ?分
          37 ???????????? < html:text? property ="second" ?name ="second" ?style ="width:20px;" ?value ="0" ?onchange ="valTime(this.value)" ? /> ?秒(0-59之間的整數(shù))
          38 ?????? </ td > ?
          39 </ tr >
          40

          OK. 這樣我們的頁面設(shè)置就完成了。: - )?

          ???????????????????????????????????????????????????????????To Be Continued...
          posted on 2007-01-10 15:39 小立飛刀 閱讀(5409) 評(píng)論(2)  編輯  收藏 所屬分類: Spring

          FeedBack:
          # re: Spring Quartz如何動(dòng)態(tài)配置時(shí)間(1)
          2007-01-10 18:36 | zxy
          繼續(xù)發(fā)揚(yáng)共享精神哦 hoho   回復(fù)  更多評(píng)論
            
          # re: Spring Quartz如何動(dòng)態(tài)配置時(shí)間(1)
          2007-01-11 10:13 | 小雪飛刀
          謝謝,我會(huì)繼續(xù)努力,呵呵  回復(fù)  更多評(píng)論
            
          <2007年1月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          生存或毀滅,這是個(gè)必答之問題:是否應(yīng)默默的忍受坎苛命運(yùn)之無情打擊,還是應(yīng)與深如大海之無涯苦難奮然為敵,并將其克服。此二抉擇,究竟是哪個(gè)較崇高?

          常用鏈接

          留言簿(12)

          隨筆分類(43)

          相冊(cè)

          收藏夾(7)

          朋友的博客

          電子資料

          搜索

          •  

          積分與排名

          • 積分 - 302745
          • 排名 - 192

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 拉萨市| 甘肃省| 乳源| 沅江市| 略阳县| 婺源县| 绥中县| 澳门| 郓城县| 大方县| 大冶市| 德兴市| 南宫市| 米林县| 通化市| 榕江县| 沁源县| 古田县| 汉中市| 体育| 当阳市| 旺苍县| 买车| 湖口县| 修武县| 平江县| 丁青县| 城步| 玉田县| 建湖县| 驻马店市| 盐边县| 东源县| 廉江市| 偃师市| 常熟市| 阿克| 长顺县| 沈丘县| 东丰县| 习水县|