struts 批量提交

           

          public class ShowValueForm extends ActionForm {
           /** 上次示數(SCSS),對應的對象屬性 */
           private double bcss = 0.0D;
           //定義一個放n個ShowValueForm的ArrayList
           private ArrayList formlst = new ArrayList();
           /**
            * 上次示數(SCSS),對應的對象屬性
            * @param scss
            */
           public void setBcss(double bcss) {
            this.bcss = bcss;
           }
           /**
            * 上次示數(SCSS),對應的對象屬性
            * @return
            */
           public double getBcss() {
            return this.sbss;
           }
           /**
            * 返回頁面封裝的FORM集合。
            */
           public ArrayList getFormlst() {
            return this.formlst;
           }
           /**
            * 在頁面中得到多個form
            * @param i:對應頁面中的相應的form
            * @return
            */
           public ShowValueForm getComp(int i) {
            if (formlst == null)
             formlst = new ArrayList();
             if (formlst.size() <= i) {
              for (int j = formlst.size(); j <= i; j++)
              formlst.add(new ShowValueForm());
             }
             return (ShowValueForm) formlst.get(i);
            }

          }

          public class ShowValueAction extends DispatchAction{
           public ShowValueAction() {
            super();
            
           }

           /**更新要修改的記錄,將返回的結果顯示到頁面。
            * @param mapping
            * @param form
            * @param request
            * @param response
            * @return
            */
           public ActionForward saveForms(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
           {
            ActionForward forward = new ActionForward();  
            ShowValueForm frm = (ShowValueForm) form;
            
            List valuelst = new ArrayList();
            String load = request.getParameter("load");

            ArrayList updatelst = frm.getFormlst();
            //更新并得到更新后的結果
            ............
            return  mapping.findForward("savelist");
           }


          =========================================================================
          頁面
          <html:form action="/showValueInputAction" method="post">
          <input type="hidden" name="method" id="method" value="saveForms">
          <TABLE  cellpadding="0" cellspacing="1">
          <TR >
          <TH  width="80" nowrap>本次示數</TH>
          </TR>
          <logic:iterate id="item" name="valuelst" scope="request" type="java.util.HashMap" indexId="index">
          <TR id="<%=index%>" class="<%=index.intValue() % 2 == 0 ? "dataTable_rowNormal" : "dataTable_rowShadow"%>">
          <TD nowrap><input type="text" size="10" name="comp[<%=index%>].bcss" value="<bean:write name="item" property="BCSS" />"></TD>
          </TR>
          </logic:iterate>
          </TABLE>



          歡迎大家訪問我的個人網站 萌萌的IT人

          posted on 2007-12-13 15:33 見酒就暈 閱讀(574) 評論(0)  編輯  收藏 所屬分類: J2EE文章

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿(3)

          我參與的團隊

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          BLOG

          FRIENDS

          LIFE

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 徐州市| 武功县| 抚顺市| 福建省| 泰州市| 漯河市| 永州市| 射洪县| 麦盖提县| 辽宁省| 德阳市| 玉树县| 玉门市| 汾阳市| 卢龙县| 宣武区| 体育| 共和县| 巴彦淖尔市| 彭泽县| 虎林市| 汽车| 双流县| 乌兰浩特市| 格尔木市| 永顺县| 石景山区| 正安县| 吴江市| 八宿县| 富锦市| 望城县| 中西区| 昌图县| 日照市| 弥勒县| 韩城市| 景泰县| 高淳县| 正蓝旗| 克山县|