飞舞的幻想

常用链接

统计

Google Adsense

Zanox FWHX

花个明白

最新评论

Struts下jsp页面的一些特殊小功能以及查询语句经常犯错误

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> 中出现了关键字 length width 直接使的定义的样式不能正常显示。

2、  多表关联查询

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 里面有这个构造函数,而且字典,关联也都没有错误。可是在查询出来的结果却有没有达到效果。原因就是关联了 pub.data.operator 表但是没有使用这个条件。所以结果就是查询的符合条件的记录关联 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,' 准成本租金 ');isNum(rlevelRent,' 准成本租金 ') " ></ 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,' 基准租金 ');isNum(levelRent,' 基准租金 ') " ></ 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 。方法是:先进入 sql 的安装光盘找到 msde 目录,里面有个 setup ,安装后重启一遍系统就会发现已经有了服务管理器了,然后在照常安装 sql2000 就可以了。这样安装后的 sql 就和在服务器上安装的 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 飞舞的幻想 阅读(2484) 评论(0)  编辑  收藏 所属分类: 框架学习


只有注册用户登录后才能发表评论。


网站导航: