<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 15, 文章 - 0, 評論 - 5, 引用 - 0
    數據加載中……

    2008年7月30日

    4xx - 客戶端錯誤

    發生錯誤,客戶端似乎有問題。例如,客戶端請求不存在的頁面,客戶端未提供有效的身份驗證信息。 ·400 - 錯誤的請求。
    ·401 - 訪問被拒絕。IIS 定義了許多不同的 401 錯誤,它們指明更為具體的錯誤原因。這些具體的錯誤代碼在瀏覽器中顯示,但不在 IIS 日志中顯示: ·401.1 - 登錄失敗。
    ·401.2 - 服務器配置導致登錄失敗。
    ·401.3 - 由于 ACL 對資源的限制而未獲得授權。
    ·401.4 - 篩選器授權失敗。
    ·401.5 - ISAPI/CGI 應用程序授權失敗。
    ·401.7 – 訪問被 Web 服務器上的 URL 授權策略拒絕。這個錯誤代碼為 IIS 6.0 所專用。

    ·403 - 禁止訪問:IIS 定義了許多不同的 403 錯誤,它們指明更為具體的錯誤原因: ·403.1 - 執行訪問被禁止。
    ·403.2 - 讀訪問被禁止。
    ·403.3 - 寫訪問被禁止。
    ·403.4 - 要求 SSL。
    ·403.5 - 要求 SSL 128。
    ·403.6 - IP 地址被拒絕。
    ·403.7 - 要求客戶端證書。
    ·403.8 - 站點訪問被拒絕。
    ·403.9 - 用戶數過多。
    ·403.10 - 配置無效。
    ·403.11 - 密碼更改。
    ·403.12 - 拒絕訪問映射表。
    ·403.13 - 客戶端證書被吊銷。
    ·403.14 - 拒絕目錄列表。
    ·403.15 - 超出客戶端訪問許可。
    ·403.16 - 客戶端證書不受信任或無效。
    ·403.17 - 客戶端證書已過期或尚未生效。
    ·403.18 - 在當前的應用程序池中不能執行所請求的 URL。這個錯誤代碼為 IIS 6.0 所專用。
    ·403.19 - 不能為這個應用程序池中的客戶端執行 CGI。這個錯誤代碼為 IIS 6.0 所專用。
    ·403.20 - Passport 登錄失敗。這個錯誤代碼為 IIS 6.0 所專用。

    ·404 - 未找到。 ·404.0 -(無) – 沒有找到文件或目錄。
    ·404.1 - 無法在所請求的端口上訪問 Web 站點。
    ·404.2 - Web 服務擴展鎖定策略阻止本請求。
    ·404.3 - MIME 映射策略阻止本請求。

    ·405 - 用來訪問本頁面的 HTTP 謂詞不被允許(方法不被允許)
    ·406 - 客戶端瀏覽器不接受所請求頁面的 MIME 類型。
    ·407 - 要求進行代理身份驗證。
    ·412 - 前提條件失敗。
    ·413 – 請求實體太大。
    ·414 - 請求 URI 太長。
    ·415 – 不支持的媒體類型。
    ·416 – 所請求的范圍無法滿足。
    ·417 – 執行失敗。
    ·423 – 鎖定的錯誤。

    posted @ 2008-08-04 14:16 zhouzhou@ 閱讀(312) | 評論 (1)編輯 收藏

    小結 Commons BeanUtils

     

    Commons BeanUtils 的官方網址:http://commons.apache.org/beanutils/

    Commins BeanUtils是針對JavaBeans一般性操作的組件,可以用來對JavaBeans進行復制,屬性的讀取,設置,修改,還以動態構造JavaBeans對象。

    使用這個組件需要三個Jar文件
    其中兩個是 commons-logging-1.1.1下的commons-logging-1.1.1.jar 和commons-logging-api-1.1.1.jar
    剩下一個是   commons-beanutils-1.8.0-BETA   下的commons-beanutils-1.8.0-BETA.jar
    把這三個加入到項目的構件路徑下即可。

    下面為一個簡單的例子

    新建User Profile Address BeanUtilsExample 四個類


    1 User.java

    package com.v503.zhouzhou;

    public class User {
     private Long userId;
     private String username;
     private String password;
     private Profile profile;

     public Long getUserId() {
      return userId;
     }

     public  void setUserId(Long userId) {
      this.userId = userId;
     }

     public String getUsername() {
      return username;
     }

     public void setUsername(String username) {
      this.username = username;
     }

     public String getPassword() {
      return password;
     }

     public void setPassword(String password) {
      this.password = password;
     }

     public Profile getProfile() {
      return profile;
     }

     public void setProfile(Profile profile) {
      this.profile = profile;
     }

    }

    2 Profile.java

    package com.v503.zhouzhou;

    import java.util.Date;
    import java.util.Map;

     

    public class Profile {
     private Map<String, String> phone;
     private Address[] address;
     private Date birthDate;
     private String email;

     public Map<String, String> getPhone() {
      return phone;
     }

     public void setPhone(Map<String, String> phone) {
      this.phone = phone;
     }

     public Address[] getAddress() {
      return address;
     }

     public void setAddress(Address[] address) {
      this.address = address;
     }

     public Date getBirthDate() {
      return birthDate;
     }

     public void setBirthDate(Date birthDate) {
      this.birthDate = birthDate;
     }

     public String getEmail() {
      return email;
     }

     public void setEmail(String email) {
      this.email = email;
     }

    }



    3 Address.java

    package com.v503.zhouzhou;

    public class Address {
     private String postCode;
     private String country;
     private String city;
     private String addr;

     public Address() {

     }

     public Address(String postCode, String country, String city, String addr) {
      this.postCode = postCode;
      this.country = country;
      this.city = city;
      this.addr = addr;
     }

     public String getPostCode() {
      return postCode;
     }

     public void setPostCode(String postCode) {
      this.postCode = postCode;
     }

     public String getCountry() {
      return country;
     }

     public void setCountry(String country) {
      this.country = country;
     }

     public String getCity() {
      return city;
     }

     public void setCity(String city) {
      this.city = city;
     }

     public String getAddr() {
      return addr;
     }

     public void setAddr(String addr) {
      this.addr = addr;
     }

    }



    4 BeanUtilsExample.java


    package com.v503.zhouzhou;

    import java.lang.reflect.InvocationTargetException;
    import java.util.GregorianCalendar;
    import java.util.HashMap;
    import java.util.Map;

    import org.apache.commons.beanutils.BeanUtils;
    import org.apache.commons.beanutils.PropertyUtils;


    public class BeanUtilsExamples {

     @SuppressWarnings("unused")
     private User prepareData() {
      Address[] address = { new Address("111111", "中國", "保定", "河北大學"),
        new Address("22222", "中國", "保定", "河北大學工商學院") };
      Profile profile = new Profile();
      profile.setBirthDate(new GregorianCalendar(1987, 04, 17).getTime());
      profile.setEmail("aa1987417@126.com");
      Map<String, String> phone = new HashMap<String, String>();
      phone.put("mobilephone", "1532222706");
      phone.put("home", "110");
      profile.setPhone(phone);
      profile.setAddress(address);

      User user = new User();
      user.setUserId(new Long(503));
      user.setUsername("zhouzhou");
      user.setProfile(profile);
      user.setPassword("hicc");
      return user;

     }

     public static void main(String[] args) {
      BeanUtilsExamples a = new BeanUtilsExamples();
      User user = a.prepareData();
      System.out.println("輸出對象的屬性值---------------------------------");
      try {
       System.out.println(BeanUtils.getProperty(user, "userId"));       //BeanUtils中讀取屬性的方法getProperty()
       System.out.println(BeanUtils.getProperty(user, "username"));
       System.out.println(BeanUtils.getProperty(user, "password"));
       System.out.println(BeanUtils.getProperty(user, "profile.email"));
       System.out.println(BeanUtils.getProperty(user, "profile.birthDate"));
       System.out.println(BeanUtils.getProperty(user, "profile.phone(home)"));
       System.out.println(BeanUtils.getProperty(user, "profile.phone(mobilephone)"));
       System.out.println(BeanUtils.getProperty(user, "profile.address[0].city"));
       System.out.println(PropertyUtils.getProperty(user, "profile.address[1].country"));
       
       User user2 = new User();
       BeanUtils.copyProperties(user2, user); //BeanUtils中復制屬性的方法getProperty()

       System.out.println("輸出復制屬性的屬性值-------------------------------");
       System.out.println(BeanUtils.getProperty(user, "username"));
       System.out.println(BeanUtils.getProperty(user, "profile.birthDate"));
       System.out.println(BeanUtils.getProperty(user, "profile.phone(home)"));
       System.out.println(BeanUtils.getProperty(user, "profile.address[0].city"));
       
       
       System.out.println("輸出復制屬性修改以后的屬性值---------------------");
       BeanUtils.setProperty(user2, "userId", new Long(8888888));   //設置屬性的方法
       PropertyUtils.setProperty(user2, "username", "周旭");
       BeanUtils.setProperty(user2, "profile.email", "549748067@qq.com");
       BeanUtils.setProperty(user2, "profile.birthDate", new GregorianCalendar(2008, 8, 1).getTime());
       BeanUtils.setProperty(user2, "profile.address[0]", new Address("6666666", "中國","紫園","保定"));
       System.out.println(BeanUtils.getProperty(user2, "userId"));
       System.out.println(BeanUtils.getProperty(user2, "username"));
       System.out.println(BeanUtils.getProperty(user2, "profile"));
       System.out.println(BeanUtils.getProperty(user2, "profile.email"));
       System.out.println(BeanUtils.getProperty(user2, "profile.birthDate"));
       System.out.println(BeanUtils.getProperty(user2, "profile.address[0].city"));

       System.out.println("與被復制屬性值的對象的比較-------------------------------");
       System.out.println(BeanUtils.getProperty(user, "userId"));
       System.out.println(BeanUtils.getProperty(user, "username"));
       System.out.println(BeanUtils.getProperty(user, "profile"));
       System.out.println(BeanUtils.getProperty(user, "profile.email"));
       System.out.println(BeanUtils.getProperty(user, "profile.birthDate"));
       System.out.println(BeanUtils.getProperty(user, "profile.address[0].city"));
      } catch (IllegalAccessException e) {

       e.printStackTrace();
      } catch (InvocationTargetException e) {

       e.printStackTrace();
      } catch (NoSuchMethodException e) {

       e.printStackTrace();
      }

     }

    }


     




     

    posted @ 2008-08-01 10:38 zhouzhou@ 閱讀(594) | 評論 (0)編輯 收藏

    JavaBeans對象的作用范圍

            作用范圍            對應的對象         對象的類型
             page                    pageContext          pagetext
             request                request                  servletRequest
             session                session                   HttpSession
             application           application             servletContext


    page:只對當前頁面有效

    request:在當前頁面有效,同時當這個頁面通過forward方式轉向另外頁面或通過include方式包含另外頁面,在這些另外的頁面也有效

    session:可以訪問其他的jsp頁面中,作用范圍跨頁面,但只針對一個特定的用戶

    application:任何用戶創建一個JavaBeans對象,所用戶都可以使用這個對象

    posted @ 2008-07-30 17:12 zhouzhou@ 閱讀(177) | 評論 (0)編輯 收藏

    JS驗證方法

     <!--  
      說明:每個校驗函數默認都不校驗要求的輸入長度,只有當用戶有輸入的時候才開始校驗;  
                  這樣設計的目的是因為實際應用中有的表單是可以不要輸入的,如果某個表單域要求一定輸入,  
          那就可以象最后那個表單域一樣加入長度校驗。  
      -->  
      <HTML><HEAD><TITLE>FormCheck</TITLE>  
      <META   http-equiv=Content-Type   content="text/html;   charset=gb2312">  
      <STYLE>TD   {FONT-SIZE:   12px;   COLOR:   #333333}</STYLE>  
      <SCRIPT   language=JavaScript   type=text/JavaScript    
       >

     /*焦點放置在第一個表單域*/  
      function   focusInFirst(){  
        document.forms[0].elements[0].focus();}  
       
      /*判斷用戶輸入是否為空*/  
      function   isEmpty(ui)   {  
        return   (ui==null||ui=="");}  
       
      /*取得用戶輸入的字符串的長度*/  
      function   getLength(ui)   {  
        var   i,sum=0;  
        for(i=0;i<ui.length;i++)   {  
          if   ((ui.charCodeAt(i)>=0)   &&   (ui.charCodeAt(i)<=255))  
            sum++;  
              else  
        sum+=2;}  
        return   sum;}  
       
      /*是否為數字、字母或下劃線*/  
      function   isNLU(ui)   {  
          var   valid=/^\w*$/;  
          return   (valid.test(ui));}  
       
      /*判斷是否為身份證號碼*/  
      function   isIdno(ui){  
          var   valid=/(^\d{16}$)|(^\d{18}$)/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為郵政編碼*/  
      function   isPostCode(ui){  
          var   valid=/^\d{6}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為固定電話*/  
      function   isChinaTel(ui){  
          var   valid=/^0\d{2,3}\-\d{7,8}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為移動電話*/  
      function   isChinaMob(ui){  
          var   valid=/^0?13[0,1,3,5,6,8,9]\d{8}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為電話,只能為固定電話或移動電話*/  
      function   isTel(ui){  
          var   valid=/(^0\d{2,3}\-\d{7,8}$)|(^0?13[0,1,3,5,6,8,9]\d{8}$)/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為郵件*/  
      function   isMail(ui){  
        if(isEmpty(ui)){return   true;}  
          var   notValid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(^\-)|(\-\.)|(\.\-)/;  
          var   valid=/^.+\@[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}$/;  
        return   (!notValid.test(ui)&&valid.test(ui));}  
       
      /*用戶輸入字符串長度是否在兩值之間*/  
      function   isLenBetween(ui,minl,maxl)   {  
          return   (ui>=minl&&ui<=maxl);}

     


    </SCRIPT>  
       
      <SCRIPT   language=JavaScript>  
      <!--  
      function   formCheck(){  
      if(!isIdno(document.testForm.id.value)){  
        alert("身份證號碼輸入有誤!要求只能輸入數字,長度為16或18位。");  
        document.testForm.id.focus();  
        return   false;}  
      if(!isChinaTel(document.testForm.tel.value)){  
        alert("固定電話號碼輸入有誤!合法的格式為:區號-電話號碼。");  
        document.testForm.tel.focus();  
        return   false;}  
      if(!isChinaMob(document.testForm.mobi.value)){  
        alert("移動電話號碼輸入有誤!");  
        document.testForm.mobi.focus();  
        return   false;}  
      if(!isMail(document.testForm.mail.value)){  
        alert("郵箱輸入有誤!");  
        document.testForm.mail.focus();  
        return   false;}  
      if(!isPostCode(document.testForm.post.value)){  
        alert("郵政編碼輸入有誤!要求只能輸入數字,長度為6位。");  
        document.testForm.post.focus();  
        return   false;}  
      if(!isNLU(document.testForm.nlu.value)){  
        alert("該域只能輸入數字、字母或下劃線!");  
        document.testForm.nlu.focus();  
        return   false;}  
      var   len=getLength(document.testForm.leng.value);  
      if(len<4||len>6){  
        alert("該域要求輸入長度范圍是4至6個字符!");  
        document.testForm.leng.focus();  
        return   false;}  
      }  
      //-->  
      </SCRIPT>  
       
      <BODY   text=#000000   bgColor=#ffffff   onload=focusInFirst()>  
      <CENTER><B><FONT   face="Geneva,   Arial,   Helvetica,   san-serif"   color=#ff6600    
      size=4>The   sample   of   FormCheck</FONT></B>   <FONT    
      face="Arial,   Helvetica,   sans-serif"   size=2>(By   Roczhao)   </FONT>  
      <HR   width="60%"   color=#000000   noShade   SIZE=1>  
       
      <FORM   name=testForm   onsubmit="return   formCheck();"   method=post>  
      <TABLE   cellSpacing=0   cellPadding=0   width=500   border=1>  
          <TBODY>  
          <TR>  
              <TD   width=182   height=25>身份證:</TD>  
              <TD   width=312><INPUT   name=id>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>固定電話:</TD>  
              <TD   width=312><INPUT   name=tel>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>手機號碼:</TD>  
              <TD   width=312><INPUT   name=mobi>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>郵箱:</TD>  
              <TD   width=312><INPUT   name=mail>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>郵編:</TD>  
              <TD   width=312><INPUT   name=post>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>只能輸入數字、字母、下劃線:</TD>  
              <TD   width=312><INPUT   name=nlu>   </TD></TR>  
          <TR>  
              <TD   width=182   height=25>輸入長度在4-6之間:</TD>  
              <TD   width=312><INPUT   name=leng>   </TD></TR>  
          <TR   align=center>  
              <TD   colSpan=2   height=25><INPUT   type=submit   value="     點擊測試     "   name=Submit>    
              </TD></TR></TBODY></TABLE></FORM></CENTER></BODY></HTML>  
       
       
       
      /*js函數文件   formcheck.js*/  
       
      /*------------------------------------------------------------------------------  
        *   File:   formcheck.js   
        *   Description:FormCheck組件的函數庫文件(部分),共計110個方法  
        *------------------------------------------------------------------------------*/  
      /*焦點放置在第一個表單域*/  
      function   focusInFirst(){  
        document.forms[0].elements[0].focus();}  
       
      /*判斷用戶輸入是否為空*/  
      function   isEmpty(ui)   {  
        return   (ui==null||ui=="");}  
       
      /*取得用戶輸入的字符串的長度*/  
      function   getLength(ui)   {  
        var   i,sum=0;  
        for(i=0;i<ui.length;i++)   {  
          if   ((ui.charCodeAt(i)>=0)   &&   (ui.charCodeAt(i)<=255))  
            sum++;  
              else  
        sum+=2;}  
        return   sum;}  
       
      /*是否為數字、字母或下劃線*/  
      function   isNLU(ui)   {  
          var   valid=/^\w*$/;  
          return   (valid.test(ui));}  
       
      /*判斷是否為身份證號碼*/  
      function   isIdno(ui){  
          var   valid=/(^\d{16}$)|(^\d{18}$)/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為郵政編碼*/  
      function   isPostCode(ui){  
          var   valid=/^\d{6}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為固定電話*/  
      function   isChinaTel(ui){  
          var   valid=/^0\d{2,3}\-\d{7,8}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為移動電話*/  
      function   isChinaMob(ui){  
          var   valid=/^0?13[0,1,3,5,6,8,9]\d{8}$/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為電話,只能為固定電話或移動電話*/  
      function   isTel(ui){  
          var   valid=/(^0\d{2,3}\-\d{7,8}$)|(^0?13[0,1,3,5,6,8,9]\d{8}$)/;  
          return   (isEmpty(ui)||valid.test(ui));}  
       
      /*判斷是否為郵件*/  
      function   isMail(ui){  
        if(isEmpty(ui)){return   true;}  
          var   notValid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(^\-)|(\-\.)|(\.\-)/;  
          var   valid=/^.+\@[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}$/;  
        return   (!notValid.test(ui)&&valid.test(ui));}  
       
      /*用戶輸入字符串長度是否在兩值之間*/  
      function   isLenBetween(ui,minl,maxl)   {  
          return   (ui>=minl&&ui<=maxl);}

    posted @ 2008-07-30 10:57 zhouzhou@ 閱讀(360) | 評論 (0)編輯 收藏

    一個簡單js驗證的例子

    <html>
     <head>
      <title>潛在用戶網絡調查</title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <script language="javascript">
     function validate(myform){
        if(myform.name.value.length==0){
           alert("請填寫用戶名!");
           myform.name.focus();
           return false;
        }
       
       
        if(myform.password.value.length==0){
           alert("密碼不能為空!");
           myform.password.focus();
           return false;
        }
     } 
     </script>
     </head>
     <body>
      <form name="form1" method="POST" action="/servlet/loginlorm1"
       id="form1" onsubmit="return validate(this)">
       <table border="0">
        <tr>
         <td align="right">
          姓名:
         </td>
         <td colspan="2" align="left">
          <input type="text" name="name" size="40">
         </td>
        </tr>
        <tr>
         <td align="right">
          密碼:
         </td>
         <td colspan="2" align="left">
          <input type="password" name="password" size="40">
         </td>
         <td>
          <input type="reset" value="reset">
          <input type="submit" value="submit">
         </td>
        </tr>

       </table>
      </form>
     </body>
    </html>

     

    posted @ 2008-07-30 10:51 zhouzhou@ 閱讀(273) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: ASS亚洲熟妇毛茸茸PICS| 亚洲伊人久久大香线蕉综合图片| 亚洲欧洲日韩不卡| 久久免费精品视频| 亚洲今日精彩视频| 亚洲精品国产免费| 亚洲无吗在线视频| 国产成人在线观看免费网站| AV激情亚洲男人的天堂国语| 免费国产综合视频在线看| 另类专区另类专区亚洲| 爱情岛论坛网亚洲品质自拍| 精品免费久久久久国产一区 | 亚洲日本在线播放| 野花高清在线观看免费3中文 | 日韩色视频一区二区三区亚洲 | 久久综合日韩亚洲精品色| 久章草在线精品视频免费观看| 亚洲av不卡一区二区三区| 国产成人精品免费视| 国产亚洲漂亮白嫩美女在线 | 好吊妞在线成人免费| 精品亚洲成a人在线观看| 亚洲乱码中文字幕手机在线| 青柠影视在线观看免费高清 | 四虎影视永久免费观看网址| 九一在线完整视频免费观看| 亚洲AV无码日韩AV无码导航| 色影音免费色资源| 极品色天使在线婷婷天堂亚洲 | 国产乱弄免费视频| 国产精品网站在线观看免费传媒| 久久亚洲AV成人无码| 波多野结衣久久高清免费| 老司机精品免费视频| 亚洲国产成a人v在线观看| 亚洲无码日韩精品第一页| 久草视频免费在线观看| 国产精品无码永久免费888| 亚洲伊人久久大香线蕉在观| 亚洲成A人片77777国产|