您的位置:首页 > 运维架构

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

2013-03-23 18:42 218 查看
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"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: