java技術博客

          jsp博客
          數(shù)據(jù)加載中……

          2009年1月17日

          jquery的ajax應用

          //定義用戶名校驗的方法
          function verify(){
              
          //首先測試一下頁面的按鈕按下,可以調用這個方法
              //使用javascript的alert方法,顯示一個探出提示框
              //alert("按鈕被點擊了!!!");

              
          //1.獲取文本框中的內容
              //document.getElementById("userName");  dom的方式
              //Jquery的查找節(jié)點的方式,參數(shù)中#加上id屬性值可以找到一個節(jié)點。
              //jquery的方法返回的都是jquery的對象,可以繼續(xù)在上面執(zhí)行其他的jquery方法
              var jqueryObj = $("#userName");
              
          //獲取節(jié)點的值
              var userName = jqueryObj.val();
              
          //alert(userName);

              
          //2.將文本框中的數(shù)據(jù)發(fā)送給服務器段的servelt
              //使用jquery的XMLHTTPrequest對象get請求的封裝
              $.get("AJAXServer?name=" + userName,null,callback);


          }


          //回調函數(shù)
          function callback(data) {
          //    alert("服務器段的數(shù)據(jù)回來了!!");
              //3.接收服務器端返回的數(shù)據(jù)
          //
              alert(data);
              //4.將服務器段返回的數(shù)據(jù)動態(tài)的顯示在頁面上
              //找到保存結果信息的節(jié)點
              var resultObj = $("#result");
              
          //動態(tài)的改變頁面中div節(jié)點中的內容
              resultObj.html(data);
              alert(
          "");
          }

          posted @ 2009-01-17 16:35 郭興華 閱讀(345) | 評論 (0)編輯 收藏

          2009年1月12日

          上海交通大學java視頻教程共31講

          上海交通大學java視頻教程共31講
          If you are interested in java, you can spend time learning about it

          posted @ 2009-01-12 22:17 郭興華 閱讀(594) | 評論 (0)編輯 收藏

          2008年11月13日

          *.class 如何打包

          先放下吧

          posted @ 2008-11-13 09:12 郭興華 閱讀(170) | 評論 (0)編輯 收藏
          java中的printf

          public class TestPrintf{
              
          public static void main(String args[]){
                  System.out.printf(
          "%+8.3f",3.14);    
                  System.out.println();            
                  System.out.printf(
          "%+-8.3f\n",3.14);
                  System.out.printf(
          "%08.3f\n",3.14);
                  System.out.printf(
          "%(8.3f\n",-3.14);
                  System.out.printf(
          "%,f\n",2356.34);
                  System.out.printf(
          "%x\n",0x4a3b);
                  System.out.printf(
          "%#x\n",0x4a3b);        
                  System.out.println(
          "------------");    
                  System.out.printf(
          "你好:%s,%3d歲,工資%-7.2f\n","張三",38,15000.00);        
                  System.out.printf(
          "你好:%1$s,%2$3d歲,%2$#x歲\n","張三",38);        
                  System.out.printf(
          "%3d,%#<x",38);
              }
              
          }

          posted @ 2008-11-13 09:09 郭興華 閱讀(381) | 評論 (0)編輯 收藏
          java中的集合

               摘要: Integer[] a = {3,25,12,79,48};         System.out.println(a);         System.out.println(Arrays.toStrin...  閱讀全文

          posted @ 2008-11-13 09:07 郭興華 閱讀(286) | 評論 (0)編輯 收藏

          2008年11月7日

          Arraylist

           

          /**
           * 測試數(shù)組列表的使用
           
          */

           
          import java.util.ArrayList;

          public class ArrayListTest
          {
              
          public static void main(String[] args)
              
          {
                  ArrayList list 
          = new ArrayList();
                  list.add(
          new Student("Tom","20020410"));
                  list.add(
          new Student("Jack","20020411"));
                  list.add(
          new Student("Rose","20020412"));

                  
          for(int i = 0; i < list.size(); i++)
                  
          {
                      System.out.println((Student)list.get(i));
                  }

              }

          }


          class Student
          {
              
          private String strName = "";//學生姓名
              private String strNumber = "";//學號
              private String strSex = "";//性別
              private String strBirthday = "";//出生年月
              private String strSpeciality = "";//專業(yè)
              private String strAddress = "";//地址

              
          public Student(String name, String number)
              
          {
                  strName 
          = name;
                  strNumber 
          = number;
              }


              
          public String getStudentName()
              
          {
                  
          return strName;
              }


              
          public String getStudentNumber()
              
          {
                  
          return strNumber;
              }


              
          public void setStudentSex(String sex)
              
          {
                  strSex 
          = sex;
              }


              
          public String getStudentSex()
              
          {
                  
          return strSex;
              }


              
          public String getStudentBirthday()
                  
          {
                  
          return strBirthday;
              }


              
          public void setStudentBirthday(String birthday)
              
          {
                  strBirthday 
          = birthday;
              }


              
          public String getStudentSpeciality()
              
          {
                  
          return strSpeciality;
              }


              
          public void setStudentSpeciality(String speciality)
              
          {
                  strSpeciality 
          = speciality;
              }


              
          public String getStudentAddress()
              
          {
                  
          return strAddress;
              }


              
          public void setStudentAddress(String address)
              
          {
                  strAddress 
          = address;
              }


              
          public String toString()
              
          {
                  String information 
          = "學生姓名=" + strName + ", 學號=" + strNumber;  
                  
          if!strSex.equals("") )
                      information 
          += ", 性別=" + strSex;
                  
          if!strBirthday.equals(""))
                      information 
          += ", 出生年月=" + strBirthday;
                  
          if!strSpeciality.equals("") )
                      information 
          += ", 專業(yè)=" + strSpeciality;
                  
          if!strAddress.equals("") )
                      information 
          += ", 籍貫=" + strAddress;
                  
          return information;
              }

          }

          posted @ 2008-11-07 16:34 郭興華 閱讀(224) | 評論 (0)編輯 收藏
          java的動態(tài)多態(tài)

          /**
           * 通過本程序的測試,主要學習抽象類及子類,抽象方法的實現(xiàn)
           * 動態(tài)綁定,多態(tài)
           
          */

           
          import java.text.NumberFormat;

          public class AbstractTest
          {
              
          public static void main(String[] args)
              
          {
                  Person[] p 
          = new Person[2];
                  p[
          0= new Worker("Jack"1000);
                  p[
          1= new Student("Tom""Computer");
                  
                  
          for(int i = 0; i < p.length; i++)
                  
          {
                      Person people 
          = p[i];
                      System.out.println(people.getDescription());
                  }

              }

          }


          /**
           * 抽象類
           
          */

          abstract class Person
          {
              
          private String strName;

              
          public Person(String strName)
              
          {
                  
          this.strName = strName;
              }


              
          public String getName()
              
          {
                  
          return strName;
              }


              
          //抽象方法,返回人的描述
              public abstract String getDescription();
          }


          /**
           * 工人類,擴展了抽象類,并實現(xiàn)了抽象方法
           
          */

          class Worker extends Person
          {
              
          private double salary;
              
              
          public Worker(String strName, double s)
              
          {
                  
          super(strName);
                  salary 
          = s;
              }

              
              
          public String getDescription()
              
          {
                  NumberFormat formate 
          = NumberFormat.getCurrencyInstance();
                  
          return "the worker with a salary of " + formate.format(salary);
              }

          }


          /**
           * 學生類,擴展了抽象類,實現(xiàn)了抽象方法
           
          */

          class Student extends Person
          {
              
          private String strMajor;
              
              
          public Student(String strName, String strMajor)
              
          {
                  
          super(strName);
                  
          this.strMajor = strMajor;
              }

              
              
          public String getDescription()
              
          {
                  
          return "the student majoring in " + strMajor;
              }

          }

          posted @ 2008-11-07 16:31 郭興華 閱讀(280) | 評論 (0)編輯 收藏
          java中的HashMapTest

               摘要: /** *//**  * 通過這個程序,測試散列映像的存儲與遍歷,方法的使用  */ import java.util.HashMap; import java.util.Collection; import java.util.Iterator; import java.util.Set; public&nb...  閱讀全文

          posted @ 2008-11-07 16:12 郭興華 閱讀(330) | 評論 (0)編輯 收藏
          java中的treeset

          /**
           * 通過這個程序,測試樹集的添加元素的無序性與輸出的有序性
           
          */

           
          import java.util.TreeSet;
          import java.util.Iterator;

          public class TreeSetTest
          {
              
          public static void main(String[] args)
              
          {
                  TreeSet tree 
          = new TreeSet();
                  tree.add(
          "China");
                  tree.add(
          "America");
                  tree.add(
          "Japan");
                  tree.add(
          "Chinese");
                  
                  Iterator iter 
          = tree.iterator();
                  
          while(iter.hasNext())
                  
          {
                      System.out.println(iter.next());
                  }

              }

          }

          posted @ 2008-11-07 16:10 郭興華 閱讀(514) | 評論 (0)編輯 收藏
          java中的treemap

               摘要: /** *//**  * 通過這個程序,測試樹映像的使用,表目集合的遍歷  */ import java.util.TreeMap; import java.util.Map; import java.util.Iterator; import java.util.Set; public class&...  閱讀全文

          posted @ 2008-11-07 16:08 郭興華 閱讀(4605) | 評論 (0)編輯 收藏
          僅列出標題  下一頁
          主站蜘蛛池模板: 金沙县| 富锦市| 九龙城区| 泊头市| 黄石市| 文安县| 五华县| 丽水市| 庆阳市| 砀山县| 桂阳县| 阳朔县| 泗水县| 钦州市| 营山县| 姚安县| 麦盖提县| 杭锦后旗| 鹤山市| 博白县| 佛山市| 西乡县| 灵台县| 精河县| 澄江县| 大渡口区| 壤塘县| 汶上县| 南皮县| 甘孜县| 芜湖县| 壶关县| 潜江市| 柳林县| 江孜县| 木里| 富阳市| 揭西县| 兴文县| 荥经县| 英吉沙县|