tosoft's blog
j2se,j2ee,j2me,opensource,框架
posts - 1,comments - 2,trackbacks - 0
    struts的 <html:option>有三种选项模式,由于最近学习用struts做项目,需要解决下拉列表从数据库读值的问题,在网络上搜索了很久,终于弄清楚了,现总结一下,并且给出例子。

一、FormBean

        private List<LabelValueBean> beanCollection;
        .....        ......
        get(),set()方法。

二、Action

        .....从数据库得到返回的List 并将返回的List对象转换成Iterator类型 遍历
             
        beanCollection.add(new LabelValueBean(“前台显示名称”,“实际值”);

        setBeanCollection(beanCollection);

三、JSP页面

        <html:select property="select" onchange="form.submit();">
                <html:optionsCollection name="form名称" property="beanCollection" />
       </html:select>

这样就解决了。。。
posted @ 2008-02-07 23:49 tosoft 阅读(809) | 评论 (2)编辑 收藏
仅列出标题