newxy的Delphi开发风格二(主细表)

17 篇文章 0 订阅

newxyDelphi开发风格二(主细表)

胡立新

 

newxy新坐标开发主细表结构的页面极其简单,如同Delphi。下面讨论如何利用newxy新坐标的标签创建主细表结构。

设主表industry(行业),相关formBeanformIndustry,保存在会话中,细表enterprise(企业),相关的formBeanformEnterprise,可保存在会话中,也可保存在pageContext中。

注意,newxy的通用动态formBean含一集合属性_coll,保存记录集。

一、例图,线演示

图上所示为点击了“制造业”后显示的相关企业。

二、策略

1、  jsp页面上得到两个formBean,分表是主表formBean,设名为formIndustry,细表formBean,设名为formEnterprise

2、  主表formBean(formIndustry)可以在本jsp页上产生,也可直接从会话中得到,细表formBean要在本jsp页上形成。从主表formBean(formIndustry)上得到细表的外键code(行业代码),再由这外键作为查询条件查得细表formBean(formEnterprise)

3、  将主细表信息显示出来。

三、实现(黑体为newxy的标签)

1、  查询得主表formBean(formIndustry)

<nbean:formBean name="formIndustry" sql="select * from table_"  />

2、  显示主表;

        <nlogic:iterate id="rec" name="formIndustry" property="_coll" leftover="true">
        <nhtml:TR οnclick="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、  得到主表当前关键字值(行业代码),存入pageContext

    <bean:define id="_code" name="formIndustry" property="code"/>

4、  根据行业代码查询得到细表formBean(formEnterprise)

<nbean:formBean name="formEnterprise" sql="select * from enterprise where industry_code=''$ {_code}"/>

5、  显示细表:

        <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>

四、相关连接

1、  newxy新坐标技术网站http://www.newxy.net

2、  在线演示:newxydelphi开发风格二(主细表)http://demo.newxy.net/delphi/sample2.jsp

3、  在线演示:newxydelphi开发风格一http://demo.newxy.net/delphi/sample1.jsp

4、  DAO+通用持久类+通用动态formBean类,实现数据增、删、改、查http://www.newxy.net/zh_cn/introduction/application/index.jsp?item=daoDtoAndForm

5、  DynaFormBean类的特点http://www.newxy.net/zh_cn/introduction/docs/doc.jsp#anchor9.3

6、  newxyDelphi开发风格二(主细表)JSP源码http://demo.newxy.net/delphi/sample2_jsp.jsp

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值