waysun一路陽光

          不輕易服輸,不輕言放棄.--心是夢的舞臺,心有多大,舞臺有多大。踏踏實實做事,認認真真做人。

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
            167 隨筆 :: 1 文章 :: 64 評論 :: 0 Trackbacks
          <2008年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          公告

          開啟一扇窗,給自己一個舞臺!

          QQ:251218333,82424805
          MSN:CF1504@Hotmail.com
          E-mail:yyk1504@163.com

          �ڷQ���a�K�O�p�ƾ��ڷQ���a�K�O�p�ƾ��ڷQ���a�K�O�p�ƾ��ڷQ���a�K�O�p�ƾ��ڷQ���a�K�O�p�ƾ��ڷQ���a�K�O�p�ƾ�位來訪者

          常用鏈接

          隨筆分類(189)

          隨筆檔案(160)

          文章分類(1)

          AJAX

          搜索

          積分與排名

          最新隨筆

          最新評論

          1.首先是一個頁面的調(diào)用
          <html:form action="softevaluate/scoreSet" method="POST">
          <html:link action="softevaluate/scoreSet.do?do=setScore" paramName="Info" paramProperty="scoreId" paramId="scoreId">
          </html:form>
          2.Action事件響應(yīng)
          public class ScoreSetAction extends DispatchAction
          {
                 
          /****************************************************************/
          /****打分參數(shù)設(shè)置 添加 2008-04-11 14:59***/
           public ActionForward setScore(ActionMapping mapping, ActionForm form,
             HttpServletRequest request, HttpServletResponse response)
             throws Exception {
            /******************************************************************/
            /**添加 從數(shù)據(jù)庫獲得參數(shù),去掉最高分,去掉最低分*/
              String maxscore = "";
              String minscore = "";   
              SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
              org.hibernate.classic.Session session = sessionFactory.openSession();
              Query query =session.createQuery("from ScoreViable");
              List users=query.list();
              session.close();
              sessionFactory.close();
              for (ListIterator iterator = users.listIterator(); iterator.hasNext(); )
              {
               ScoreViable user = (ScoreViable) iterator.next();
               //System.out.println(user.getBeforCount() +"Age: " + user.getEndCount()+"http:///");
               maxscore=user.getBeforCount()+"";
               minscore=user.getEndCount()+"";
              }
              String []st=new String[2];
              st[0]=maxscore;
              st[1]=minscore;
          /****為bean   ScoreViable 賦值**********/
              ScoreViable scoreViable=new ScoreViable();
              scoreViable.setBeforCount(new Long(maxscore));
              scoreViable.setEndCount(new Long(minscore));
              request.setAttribute("scoreViable", scoreViable);

            /***********************************************************************************/
            return mapping.findForward("setScore");
           }
          }

          3.在另外的的頁面使用bean
            <logic:present name="scoreViable" scope="request"> 
            <tr>
              <td width="200" class=content><div align="right">去掉最高分個數(shù):</div></td> 
              <bean:define id="beforCount" name='scoreViable' property='beforCount' /> 
              <td width="200" class=content><input type="text" name="maxscore" value="<%=beforCount%>"/></td>
              <td width="200" class=content></td>
              <td width="200" class=content></td>
            </tr>
            <tr>
              <td width="200" class=content><div align="right">去掉最低分個數(shù):</div></td>
              <bean:define id="endCount" name='scoreViable' property='endCount' />
              <td width="200" class=content><input type="text" name="minscore" value="<%=endCount%>"/></td>
              <td width="200" class=content></td>
              <td width="200" class=content></td>
            </tr>
            </logic:present>
          4.ScoreViable.
          java  JAVA BEAN

          ublic class ScoreViable implements java.io.Serializable {

              // Fields   
               private Long id;
               private Long beforCount;
               private Long endCount;
           
              // Constructors
              /** default constructor */
              public ScoreViable() {
              }
           /** minimal constructor */
              public ScoreViable(Long id, Long beforCount, Long endCount) {
                  this.id = id;
                  this.beforCount = beforCount;
                  this.endCount = endCount;
              }
             
              /** full constructor */

            
              // Property accessors
              public Long getId() {
                  return this.id;
              }
             
              public void setId(Long id) {
                  this.id = id;
              }
              public Long getBeforCount() {
                  return this.beforCount;
              }
             
              public void setBeforCount(Long beforCount) {
                  this.beforCount = beforCount;
              }
              public Long getEndCount() {
                  return this.endCount;
              }
             
              public void setEndCount(Long endCount) {
                  this.endCount = endCount;
              }
          }

          5.struts-config.xml
            <action attribute="scoreSetForm" name="scoreSetForm"
             parameter="do" path="/softevaluate/scoreSet" scope="request"
             type="com.gpdi.softevaluate.action.ScoreSetAction">
             <forward name="list" path="/softevaluate/scoreSetList.jsp" />
             <forward name="scorelist" path="/softevaluate/scoreList.jsp" />   
             <forward name="add" path="/softevaluate/scoreSetPropertyManage.jsp" /> 
             <forward name="edit" path="/softevaluate/scoreSetPropertyManage.jsp" />
             <forward name="saveAdd" path="/softevaluate/scoreSet.do?do=list" /> 
             <forward name="setScore" path="/softevaluate/scoreCountSet.jsp" /> 
             <forward name="importScore" path="/softevaluate/scoreCountSet.jsp" /> 
                <forward name="DelList"
              path="/softevaluate/scoreSet.do?do=list" /> 
            
          </action> 
          posted on 2008-06-20 08:39 weesun一米陽光 閱讀(201) 評論(0)  編輯  收藏 所屬分類: 總結(jié)備用
          主站蜘蛛池模板: 武邑县| 霸州市| 鹤山市| 西乌| 五大连池市| 天峻县| 龙川县| 平舆县| 郎溪县| 静乐县| 大足县| 金昌市| 杭州市| 钟山县| 柯坪县| 久治县| 东光县| 通化市| 崇明县| 恩平市| 兴业县| 兴山县| 商河县| 通州市| 贺兰县| 惠水县| 慈溪市| 木兰县| 嘉义市| 康定县| 宜州市| 尚志市| 泾源县| 万盛区| 嫩江县| 怀化市| 乌兰县| 杭州市| 电白县| 楚雄市| 台北县|