飛舞的幻想

          常用鏈接

          統(tǒng)計(jì)

          Google Adsense

          Zanox FWHX

          花個明白

          最新評論

          Struts下jsp頁面的一些特殊小功能以及查詢語句經(jīng)常犯錯誤

          1、? jsp 頁面的保留字問題(主要是表格的問題)

          < TABLE class = "border" >

          < TBODY >

          ?????? < TR >

          ?????? < TD >

          < P class = "title" >< bean:message key = "RoomRent.insert.title" /></ P >

          < html:errors />

          < bean:write name = "roomTotalRentForm"

          property = "message" filter = "false" />

          < DIV class = "tab-pane" >

          < DIV class = "tab-page" >

          < DIV class = "tab" >< bean:message key = "RoomRentData.add" /></ DIV >

          < TABLE border = "1" width = "100%" >

          ??? < TBODY >

          < TH nowrap align = "left" >< bean:message key = "RoomRentData.length" /></ TH >

          < TD >< html:text property = 'roomrentData.length' size = "20"

          maxlength = "20" styleId = "length" onblur = "checkLength(length10,20,' ')" ></ html:text ></ TD >

          < TH nowrap align = "left" >< bean:message key = "RoomRentData.width" /></ TH >

          < TD >< html:text property = 'roomrentData.width' size = "20"

          maxlength = "20" styleId = "width" onblur = "checkLength(width10,20,' ')" ></ html:text ></ TD >

          < TH nowrap align = "left" >< bean:message key = "RoomRentData.area" /></ TH >

          < TD >< html:text property = 'roomrentData.area' size = "20"

          maxlength = "20" styleId = "area" onclick = "getArea()" onblur = "checkLength(area,20,' 面積 ');getArea()" ></ html:text ></ TD >

          </ TR >

          < TR >

          < TD colspan = "6" align = "center" nowrap >< html:button

          property = "Save" onclick = "toSave()" styleClass = "button" >

          < bean:message key = "dataEdit.saveEdit" />

          </ html:button >

          < html:button property = "Return" onclick = "toReturn()"

          styleClass = "button" >

          < bean:message key = "dataEdit.return" />

          </ html:button ></ TD >

          </ TR >

          </ TBODY >

          </ TABLE >

          </ DIV >

          </ DIV >

          </ TD >

          </ TR >

          ??? </ TBODY >

          </ TABLE >

          上面的代碼邏輯和語法上沒任何錯誤,但是在 css 樣式顯示的時候, <TH> 可以正常顯示樣式可 <TD> 就不可以。原因是 <TD> 中出現(xiàn)了關(guān)鍵字 length width 直接使的定義的樣式不能正常顯示。

          2、? 多表關(guān)聯(lián)查詢

          Select new rent.data.RoomTotalRentData(rtr.rentId,rtr.roomId, rm.builderId,rm.unit,rm.floor,rm.room,rtr.rentRoomArea,rtr.balconyUseArea,rtr.roomType, rtr.roomDirectiond1.dictItemName,d2.dictItemName,hb.buildName)from pub.data.RoomTotalRent as rtr, pub.data.SysDictItem as d1, pub.data.SysDictItem as d2,.pub.data.HouseBuilding as hb, pub.data.RoomMng as rm , pub.data.operator as op where rtr.roomType=d1.dictItemId and d1.dictId='000212' and rtr.roomDirection=d2.dictItemId and d2.dictId='000210' and rm.roomId=rtr.roomId and rm.builderId=hb.buildId

          可以保證 rent.data.RoomTotalRentData 里面即 vo 里面有這個構(gòu)造函數(shù),而且字典,關(guān)聯(lián)也都沒有錯誤。可是在查詢出來的結(jié)果卻有沒有達(dá)到效果。原因就是關(guān)聯(lián)了 pub.data.operator 表但是沒有使用這個條件。所以結(jié)果就是查詢的符合條件的記錄關(guān)聯(lián) pub.data.operator 表中的記錄。

          3、? 單選按鈕控制文本框的隱藏和顯示

          ? 就是選中一個 radio 就顯示一個文本框 選中另外的就顯示另外的文本框沒有顯示的就隱藏

          使用 tr style.display 控制顯示和隱藏的。不多說了,看代碼吧!

          Js 代碼

          function setDisplay()

          {?? with (document.forms[0])

          ?? ? {if (document.forms[0].subsideStatment[0].checked==1) {

          ??????????? ? document.all( 'costRenth' ).style.display= "" ;

          ??????????? } else

          ??????????? { document.all( 'costRenth' ).style.display= "none" ;

          ??? ???????? }if (document.forms[0].subsideStatment[1].checked==1)

          ?????????? { document.all( 'rlevelRenth' ).style.display= "" ;

          ??????????? }else

          ??????????? { document.all( 'rlevelRenth' ).style.display= "none" ;

          ??????????? } if (document.forms[0].subsideStatment[2].checked==1)

          ???????????? { document.all( 'levelRenth' ).style.display= "" ;

          ?? ????????? }else

          ?? ?????????{ document.all( 'levelRenth' ).style.display= "none" ;

          ?? ????????? }

          }

          }

          Jsp 代碼

          < TR >

          < TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.subsideStatment" /> < font color = "red" > * </ font ></ TH >

          < TD colspan = "7" >< html:radio property = "data.subsideStatment"

          value = "213001" styleId = "subsideStatment" onclick = "setDisplay()" onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.all" />

          </ html:radio > < html:radio property = "data.subsideStatment"

          value = "213002" styleId = "subsideStatment" onclick = "setDisplay()"

          onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.part" /></ html:radio > < html:radio property = "data.subsideStatment" value = "213003" styleId = "subsideStatment" onclick = "setDisplay()" onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.no" />

          </ html:radio ></ TD >

          </ TR >

          < TR id = "costRenth" style = "display:none" >

          < TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.costRent" /></ TH >

          < TD colspan = "7" >< html:text property = "data.costRent" styleId = "costRent" size = "10" maxlength = "20" onblur = "checkLength(costRent,20,' 成本租金 ');isNum(costRent,' 成本租金 ')" ></ html:text >

          </ TD >

          </ TR >

          < TR id = "rlevelRenth" style = "display:none" >

          < TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.rlevelRent" /></ TH >

          < TD colspan = "7" >< html:text property = "data.rlevelRent" styleId = "rlevelRent" size = "10" maxlength = "20"

          onblur = "checkLength(rlevelRent,20,' 準(zhǔn)成本租金 ');isNum(rlevelRent,' 準(zhǔn)成本租金 ') " ></ html:text >

          </ TD >

          </ TR >

          < TR id = "levelRenth" style = "display:none" >< TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.levelRent" /></ TH >

          < TD colspan = "7" >< html:text property = "data.levelRent"

          styleId = "levelRent" size = "10" maxlength = "20 onblur = "checkLength(levelRent,20,' 基準(zhǔn)租金 ');isNum(levelRent,' 基準(zhǔn)租金 ') " ></ html:text >

          </ TD >

          </ TR >

          4、? 下拉列表顯示和隱藏文本框

          ? 同單選按鈕

          Js 代碼

          function casCade()

          {if (document.forms[0].roomType.value== "212001" )

          ??? { document.all( 'totalFloorb' ).style.display= "none" ;

          ??? document.all( 'totalFloort' ).style.display= "none" ;

          ??? document.all( 'roomDirectionc' ).colSpan=6;

          ?? }if (document.forms[0].roomType.value== "212002" )

          ??? { document.all( 'totalFloorb' ).style.display= "" ;

          ?? ? document.all( 'totalFloort' ).style.display= "" ;

          ??? document.all( 'roomDirectionc' ).colSpan=1;

          ?? }

          }

          Jsp 代碼

          < TD id = "roomDirectionc" colspan = "6" >< html:select property = "data.roomDirection" styleId = "roomDirections" styleClass = "iform" onclick = "casCade()" >

          < html:option value = "" />

          < html:options collection = "roomDirectionList"

          property = "dictItemId" labelProperty = "dictItemName" />

          </ html:select ></ TD >

          < TH nowrap align = "left" id = "totalFloorb" style = "display:none" >< bean:message

          key = "RoomTotalRentData.totalFloor" /></ TH >

          < TD colspan = "3" id = "totalFloort" style = "display:none" >< html:text

          property = "data.totalFloor" styleId = "totalFloor" size = "10" maxlength = "20" onblur = "checkLength(totalFloor,20,' 樓房總樓層 ');isInt(totalFloor,' 樓房總樓層 ')" readonly = "true" ></ html:text ></ TD >

          5、? xp 下面可以裝 sql2000 。方法是:先進(jìn)入 sql 的安裝光盤找到 msde 目錄,里面有個 setup ,安裝后重啟一遍系統(tǒng)就會發(fā)現(xiàn)已經(jīng)有了服務(wù)管理器了,然后在照常安裝 sql2000 就可以了。這樣安裝后的 sql 就和在服務(wù)器上安裝的 sql 一樣了。

          6、? 一個在線的 DHTML 參考手冊 http://www.phpx.com/man/dhtmlcn/ 什么屬性一查就知很方便的

          7、? 一個在線的 Javascipt 中文手冊 http://man.ddvip.com/web/JScriptzhref/index.html

          ?

          posted on 2006-05-17 18:06 飛舞的幻想 閱讀(2494) 評論(0)  編輯  收藏 所屬分類: 框架學(xué)習(xí)

          主站蜘蛛池模板: 静宁县| 德江县| 益阳市| 新宾| 沧州市| 漳州市| 鱼台县| 阜康市| 桂东县| 玛曲县| 呼和浩特市| 通榆县| 渭南市| 克什克腾旗| 禄丰县| 化隆| 奉贤区| 葵青区| 安福县| 阜南县| 枣庄市| 德州市| 新余市| 兴文县| 余姚市| 长治县| 祁连县| 三穗县| 阳新县| 平潭县| 肃宁县| 灵川县| 海门市| 门头沟区| 奎屯市| 宜城市| 扶风县| 托克托县| 峨眉山市| 和龙市| 泗水县|