在用Pojo开发的项目中用到struts的ActionForm时可以利用ActionForm中嵌套bean功能。注意一点是ActionForm中的pojo对象赢初始化。否则struts会出现找不到属性异常
jsp调用
public class CardLibForm extends ValidatorForm {
private CardLib cardLib = new CardLib()
private org.apache.struts.upload.FormFile theFile;
public CardLib getCardLib() {
return cardLib;
}
public void setCardLib(CardLib cardLib) {
this.cardLib = cardLib;
}
}
public class CardLib {
private int id;
private String company;
......
}
jsp调用
<p>公司
<html:text property="cardLib.company"></html:text>
</p>