张孝祥老师struct视频学习笔记1-optionsCollection标签的使用

1.我们可以使用structs 的标签来实现将一个web域对象展示到页面的功能:

<html:optionsCollection name="depts" value="id" label = "name"/>

前提:

list<Dept> depts = new ArrayList<Dept>();

depts.add();...

request.setAttribute("depts", depts)

这样就可以实现一个dropdown list的自动填充。

如果我们的前提变了。

是我们有 

  Corporation cor = new Corporation();

cor.depts = depts;

request.setAttribute("corp", cor);

这是的optionsCollection怎么写呢?

<html:optionCollection name="corp" property = "depts" value="id" label="name"/>

 

posted on 2013-03-23 18:42  要强小伙  阅读(208)  评论(0编辑  收藏  举报