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 on 2008-02-07 23:49 tosoft 閱讀(812) 評論(2)  編輯  收藏

          FeedBack:
          # re: 解決struts下拉菜單選項從數據庫讀值的問題
          2008-10-26 21:33 |
          簡潔明了  回復  更多評論
            
          # re: 解決struts下拉菜單選項從數據庫讀值的問題[未登錄]
          2008-10-26 21:37 | xxx
          @比
          ......<html>
          <script>
          alert("fdsfdsafdsa")
          </script>
          <body>


          </body>

          </html>  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 清镇市| 福泉市| 酒泉市| 林周县| 德州市| 泰宁县| 南投市| 连江县| 遂川县| 略阳县| 嘉荫县| 丰城市| 贵州省| 阿克陶县| 垦利县| 宜黄县| 保康县| 綦江县| 中方县| 天长市| 石家庄市| 木里| 连平县| 晴隆县| 肇东市| 吐鲁番市| 都江堰市| 宝山区| 师宗县| 普陀区| 会泽县| 浦江县| 北海市| 宣城市| 富顺县| 镇原县| 怀安县| 九台市| 金寨县| 岱山县| 霍山县|