2009年8月2日

          一切都是那么的措手不及
          你來的那么突然
          令我一點防備都沒有
          我對你的到來很無奈
          但我又不得不好好待你
          你是我的眼中釘
          我的手中刺
          我發誓要殺掉你
          不讓你再禍害其他人
          我在努力地做著我該做的事
          天啊 又出bug了

          posted @ 2009-09-26 15:54 BBT_soft 閱讀(142) | 評論 (0)編輯 收藏

          163          smtp.163.com                   pop.163.com

          126          smtp.126.com                   pop3.126.com

          188          smtp.188.com                    pop3.188.com

          yeah       smtp.yeah.net                   pop3.yeah.net

          sina         smtp.sina.com                   pop.sina.com

          qq            smtp.qq.com                        pop.qq.com

          yahoo       smtp.mail.yahoo.com.cn      pop.mail.yahoo.com.cn    yahoo前提是開通來信提醒業務

          yahoo      smtp.mail.yahoo.cn              pop.mail.yahoo.cn

          google     smtp.gmail.com                    pop.gmail.com

          tom          smtp.tom.com                       pop.tom.com

          sogou      smtp.mail.sogou.com            pop3.mail.sogou.com

          sohu        smtp.sohu.com                     pop3.sohu.com

          139          smtp.139.com                       pop.139.com

          china        smtp.china.com                    pop.china.com    中華網郵箱

          21CN        smtp.21cn.net                      pop3:pop.21cn.net     商務郵箱服務器

                           smtp.21cn.com                     pop3:pop.21cn.com    經濟郵箱服務器
                   
                           smtp.21cn.com                     pop3:pop.21cn.com 免費郵箱服務器

          posted @ 2009-08-08 12:42 BBT_soft 閱讀(2719) | 評論 (4)編輯 收藏

          《think in java》中有這么一段話:

          如果想比較兩個對象的實際內容是否相同,又該如何操作呢?此時,必須使用所有對象都使用的特殊方法equals()。但這個方法不適用于"基本類型",基本類型直接使用==和!=即可。如:

          Integer n1 = new Integer(47);
          Integer n2 = new Integer(47);
          System.out.println(ne.equals(n2));

          正如我們預計的那樣,此時得到的結果是true。但事實上并不總是這么簡單!假設您創建了自己的類,像下面這樣:
          class Value{
          int i;
          }
          public class Test{

                public static void main(String[] args){
                       Value v1 = new Value();
                      Value v2 = new Value();
                       System.out.println(v1.equals(v2));
              }
          }
          此時的結果又變回了false!

          這是由于equals()的默認行為是比較引用。所以除非在自己的新類中重載equals()方法,否則不可能表現出我們希望的行為。

          大多數Java類庫都實現了用來比較對象內容的equals()方法,而非比較對象引用的equals()方法。

          個人理解:equals()默認行為是比較引用,只是現在絕大多數Java類庫都實現了用來比較對象內容的equals()方法,而并沒有實現比較對象引用的equals()方法。所以現在說equals()比較的是內容,如果自己的類實現比較對象引用的equals()方法,也可以說equals()比較對象的引用,只是實現問題。

          posted @ 2009-08-08 12:38 BBT_soft 閱讀(2052) | 評論 (6)編輯 收藏

          由于我用的是struts框架,就拿整個項目介紹:

          1.首先把jstl的兩個常用包jstl.jar、standard.jar加載到環境中

          2.Action代碼:(整個過程不需要了解,這兒方法就是返回一個封裝Students對象的list,然后request.setAttribute("list", list)起來)

          public ActionForward selectStudent(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response) {
             StudentForm studentForm = (StudentForm) form;
             DBConnection dbconn = new DBConnection();
             Connection conn = dbconn.getConnection();
             StudentServiceFactory serviceFactory = new StudentServiceFactory();
             List list = serviceFactory.getStudentService().selectStudent(conn);
             request.setAttribute("list", list);
             try {
              conn.close();
             } catch (SQLException e) {
              e.printStackTrace();
             }
             return mapping.findForward("show");
          }

          3.show.jsp頁面:

          <%@ page language="java" pageEncoding="utf-8"%>
          <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>//這三句很重要

          <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>

          <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
          <%
          String path = request.getContextPath();
          String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
          %>

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
          <html>
          <head>
              <base href="<%=basePath%>">
             
              <title>My JSP 'show.jsp' starting page</title>
             
          <meta http-equiv="pragma" content="no-cache">
          <meta http-equiv="cache-control" content="no-cache">
          <meta http-equiv="expires" content="0">   
          <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
          <meta http-equiv="description" content="This is my page">
          <!--
          <link rel="stylesheet" type="text/css" href="styles.css">
          -->

          </head>

          <body>
              查詢結果如下: <br>
          <table>
             <tr>
              <td>ID</td>
              <td>姓名</td>
             </tr>
            <c:forEach items="${list}" var="student">// items為list的一個迭代器,list為Action中傳遞過來的list,student為Student類對象
             <tr>
             <td>${student.id }</td>//輸出student的id屬性
              <td>${student.name }</td>//輸出student的name屬性
             </tr>
             </c:forEach>

          <logic:iterate id="li" name="list" type="vo.Student">//id為自定義的名字,name為Action中傳過來的list,type為實體類,包括完整路徑,這里是vo.Student
              <tr>
               <td><bean:write name="li" property="id"/></td>//name為邏輯名,和logic:iterate id="li"中的id對應,property為實體類中真正的屬性
               <td><bean:write name="li" property="name"/></td>
               <td><a href="student.do?method=deleteStudent&id=<bean:write name="li" property="id"/>">刪除</a></td>
              </tr>
             </logic:iterate>


          </table>
          <a href="student.jsp">返回</a>
          </body>
          </html>

          在JSP頁面引入Struts標簽庫的時候有所不同:

          struts1.3的為:

          <%@ taglib uri=" <%@ taglib uri=" <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>或者<%@ taglib uri="

          posted @ 2009-08-02 16:21 BBT_soft 閱讀(2180) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 兴国县| 加查县| 龙南县| 富顺县| 资源县| 牡丹江市| 金堂县| 贡山| 定结县| 侯马市| 金阳县| 韶关市| 会宁县| 黄浦区| 鸡东县| 吴川市| 南昌市| 牡丹江市| 安达市| 阿尔山市| 林口县| 苍溪县| 云浮市| 寻乌县| 西宁市| 泸定县| 兴安盟| 虎林市| 清新县| 佳木斯市| 新龙县| 永年县| 怀集县| 双江| 东至县| 兴宁市| 宣汉县| 屏东市| 论坛| 正镶白旗| 新干县|