1)在中引入domain/xxx.java
private List tstatus;
2) 在Action中调用关联表的方法,并set到主表的from中
//加在execute()方法中
List sta = stDao.getPStatus();
tp.setTstatus(sta);
request.setAttribute("status",sta);
3)在页面得值
下面有两种方式,一般用第二种,如果得不到结果集的话就改成第一种。
<html:select property="formvalue(status)" disabled="true" size="1">
<html:option value="">(none)</html:option>
<logic:iterate id="st" name="status" scope="request">
<html:option value="${st.statusCode}">
<bean:write name="st" property="statusDescr"/>
</html:option>
</logic:iterate>
</html:select>
<html:select property="formvalue(status)" disabled="true" size="1">
<html:optionsCollection property="formvalue(tstatus)" label="statusDescr" value="statusCode"/>
</html:select>
private List tstatus;
2) 在Action中调用关联表的方法,并set到主表的from中
//加在execute()方法中
List sta = stDao.getPStatus();
tp.setTstatus(sta);
request.setAttribute("status",sta);
3)在页面得值
下面有两种方式,一般用第二种,如果得不到结果集的话就改成第一种。
<html:select property="formvalue(status)" disabled="true" size="1">
<html:option value="">(none)</html:option>
<logic:iterate id="st" name="status" scope="request">
<html:option value="${st.statusCode}">
<bean:write name="st" property="statusDescr"/>
</html:option>
</logic:iterate>
</html:select>
<html:select property="formvalue(status)" disabled="true" size="1">
<html:optionsCollection property="formvalue(tstatus)" label="statusDescr" value="statusCode"/>
</html:select>