建议你看看 hibernate 的书
这种类似的问题,在书上已经说的很详细了如何映射,如何建立关系,如何反向关联或者双向关联,一对多,多对一,多对多等等甚至延迟加载等等。。
这种类似的问题,在书上已经说的很详细了如何映射,如何建立关系,如何反向关联或者双向关联,一对多,多对一,多对多等等甚至延迟加载等等。。
解决方案 »
- struts2 关于Action的设计方案
- 求一个反编译class的工具,要求反编译出来的java文件和原来的一模一样
- 如何通过正则表达式切取字符串
- 大家看看软件部的经理的要求合理吗?
- 求一个velocity实例!要JAVA项目,不要有servlet的!(谢谢各位了,有例子的一定给20分以上)
- tomcat5用jfreechart做图表报错
- spring用aop配置事务,结果出异常也不回滚
- 为什么Win2000 Server+Tomcat4下的JSP运行失败???急!!!
- 有关struts 的问题?给位帮忙看看!
- Spring Boot linux 服务器启动配置JDK
- net.sf.ehcache.config.Configurator#configure : No configuration found
- 到底spring能带给我们什么
这个就查查 struts 方面的东西,对不起,我不熟悉这个。但我提议你试一下这个:
<td > <bean:write name="temp" property="customer.customerId"/ > </td > <!--客户编号-- >
<td > <bean:write name="temp" property="customer.customerName"/ > </td > <!--客户名字-- >
<td >xxxxx </td >
<td >客户编号 </td >
<td >客户名字 </td >
</tr >
如果在order里面塞了customer信息 那直接customer.xx如果么塞customer,那单独传个customer对象过来
每个调的地方也是customer.xx
我试了property="customer.customerId"不行,property="${customer.customerId}"也不行怎么办呢?
回复7楼:我用的是MySQL数据库,如果即使用你那样的方法,不会搞乱顺序么?
<logic:iterate id="temp" name="orders" > <!--order包括所有定单-- >
<tr>
<td> <bean:write name="temp" property="orderId"/> </td >
<td> <bean:write name="temp" property="orderDes"/> </td >
<!--可是下面怎么输出客户编号和名字???-- >
<td>${temp.customer.customerId}</td> <!--客户编号-- >
<td>${temp.customer.customerName}</td> <!--客户名字-- >
</tr>
</logic:iterate >
我根据4楼的提醒,用define方法也试成功,谢谢。
不过9楼的方法更简单,而且回答也具体,分就给这位仁兄了。谢谢。
temp.customer.customerId取得对像的customerId