newxy
的
Delphi
開發(fā)風(fēng)格二(主細(xì)表)
胡立新
?
newxy
新坐標(biāo)開發(fā)主細(xì)表結(jié)構(gòu)的頁面極其簡單,如同
Delphi
。下面討論如何利用
newxy
新坐標(biāo)的標(biāo)簽創(chuàng)建主細(xì)表結(jié)構(gòu)。
設(shè)主表
industry(
行業(yè)
)
,相關(guān)
formBean
名
formIndustry
,保存在會話中,細(xì)表
enterprise(
企業(yè)
)
,相關(guān)的
formBean
名
formEnterprise
,可保存在會話中,也可保存在
pageContext
中。
注意,
newxy
的通用動態(tài)
formBean
含一集合屬性
_coll
,保存記錄集。
一、
例圖,
在線演示
圖上所示為點(diǎn)擊了“制造業(yè)”后顯示的相關(guān)企業(yè)。
二、
策略
1、
?
在
jsp
頁面上得到兩個
formBean
,分表是主表
formBean
,設(shè)名為
formIndustry
,細(xì)表
formBean
,設(shè)名為
formEnterprise
;
2、
?
主表
formBean(formIndustry)
可以在本
jsp
頁上產(chǎn)生,也可直接從會話中得到,細(xì)表
formBean
要在本
jsp
頁上形成。從主表
formBean(formIndustry)
上得到細(xì)表的外鍵
code
(行業(yè)代碼),再由這外鍵作為查詢條件查得細(xì)表
formBean(formEnterprise)
;
3、
?
將主細(xì)表信息顯示出來。
三、
實(shí)現(xiàn)
(
黑體為
newxy
的標(biāo)簽
)
1、
?
查詢得主表
formBean(formIndustry)
:
<nbean:formBean?name="formIndustry"?sql="select?*?from?table_"? />
2、
?
顯示主表;
????????<nlogic:iterate?id="rec"?name="formIndustry"?property="_coll"?leftover="true">
????????<nhtml:TR?onclick="edit(actIndustry);">
??????????<td?style="cursor:hand"?align="center">1</td>
??????????<td?style="cursor:hand"><nbean:write?name="rec"?property="industry"/></td>
????????</nhtml:TR>
????????</nlogic:iterate>
3、
?
得到主表當(dāng)前關(guān)鍵字值(行業(yè)代碼),存入
pageContext
:
???
<bean:define?id="
_code
"?name="formIndustry"?property="
code
"/>
4、
?
根據(jù)行業(yè)代碼查詢得到細(xì)表
formBean(formEnterprise)
:
<nbean:formBean?name="formEnterprise"?sql="select?*?from?enterprise?where?industry_code=''$ {_code}"/>
5、
?
顯示細(xì)表:
????????<nlogic:iterate?id="rec"?name="formEnterprise"?property="_coll"?leftover="true">
????????<nhtml:TR>
??????????<td?align="center">
????????????$ {index+1}
??????????</td>
??????????<td?style="cursor:hand"><nbean:write?name="rec"?property="principal"/></td>
??????????<td?style="cursor:hand"><nbean:write?name="rec"?property="name"/></td>
????????</nhtml:TR>
????????</nlogic:iterate>
四、
相關(guān)連接
1、
?
newxy
新坐標(biāo)技術(shù)網(wǎng)站
http://www.newxy.net
2、
?
在線演示:
newxy
的
delphi
開發(fā)風(fēng)格二(主細(xì)表)
http://demo.newxy.net/delphi/sample2.jsp
3、
?
在線演示:
newxy
的
delphi
開發(fā)風(fēng)格一
http://demo.newxy.net/delphi/sample1.jsp
4、
?
DAO
類
+
通用持久類
+
通用動態(tài)
formBean
類,實(shí)現(xiàn)數(shù)據(jù)增、刪、改、查
http://www.newxy.net/zh_cn/introduction/application/index.jsp?item=daoDtoAndForm
5、
?
DynaFormBean
類的特點(diǎn)
http://www.newxy.net/zh_cn/introduction/docs/doc.jsp#anchor9.3
6、
?
newxy
的
Delphi
開發(fā)風(fēng)格二(主細(xì)表)
JSP
源碼
http://demo.newxy.net/delphi/sample2_jsp.jsp
posted on 2007-03-25 00:28
newxy新坐標(biāo) 閱讀(1560)
評論(0) 編輯 收藏