当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: public class DataPoke { String
 

 

 ·jdbc连接数据库格式     »显示摘要«
    摘要:java数据库连接(jdbc)由一组用 java 编程语言编写的类和接口组成。jdbc 为工具/数据库开发人员提供了一个标准的 api,使他们能够用纯java api 来编写数据库应用程序。然而各个开发商的接口并不完全相同,所以开发环境的变化会带来一定的配置变化。本文主要集合了不同数据库的连接方式。  一、连接各种数据库方式速查表  下面罗列了各种数据库使用jdbc连接的方式,可以作为一个手册使用......
    摘要: 如何实现hibernate_struts v\:* { behavior: url(#default#vml) } o\:* { behavior: url(#default#vml) } .shape { behavior: url(#default#vml) } hibernate+struts应用程序的javawebst......


自己写的一个JSP小游戏21点,记录一下

public class datapoke {

  string pokepoint;//点数 【程序编程相关:MySQL的驱动引起Hibernate无

  string pokeface;//牌面 【推荐阅读:《CSDN社区电子杂志——java杂志》

  string pokeimgpath;//扑克图片对应地址 【扩展信息:Jsp中使用xmlhttp进行数据交互~

  string pokecolor;//花色

  boolean useflag = false;//是否使用标记false未使用,true使用中

  public datapoke() {

  }

  public void setuserflag(boolean flag){

    this.useflag = flag;

  }

  public boolean getuserflag(){

    return this.useflag;

  }

  public string getpoint(){

    return this.pokepoint;

  }

  public string getcolor(){

    return this.pokecolor;

  }

  public string getimgpath(){

    return this.pokeimgpath;

  }

  public string getpokeface(){

    return this.pokeface;

  }

}

 

///////////////////////////////////////////////////////////////////////

 

import java.util.*;

public class pokebean {

  private string [] color = {"black","red","flower","sequa"};

  private string pokeimgurl = "/m/g/bj/images/";

  private linkedlist pokelist = new linkedlist();//poke链表列表

  datapoke[] datapoke = new datapoke[52];

  public pokebean() {

  }

  public void initpokelist(){

    for(int i=0; i<=51; i++)

    {

      datapoke[i] = new datapoke();//初始化52个datapoke类变量存储

    }

    int over = 10;

    int count=0;

    for(int i=1; i<=13; i++){

      for(int j=1; j<=4; j++){

        if(i<10)

          datapoke[count].pokepoint = "" + i;//点数1-10

        else

          datapoke[count].pokepoint = ""  + over; //点数11-13

        datapoke[count].pokeface = ""+i;//牌面

        datapoke[count].pokecolor = color[j-1];//牌色1-4: 黑 红 梅 方

        datapoke[count].pokeimgpath = pokeimgurl+integer.tostring(i)+"/"+integer.tostring(j)+".png";

        datapoke[count].setuserflag(false);

        pokelist.add(count,datapoke[count]);//将用内部类datapoke初始化好的52张牌放置于linkedlist中

        //system.out.println("after insert poke --------- = "+count);

        count=count+1;

      }

    }

  }

  //初始化完毕后,进行洗牌//这里暂且不用此功能

  public void washpokelist(){

    int temp1 = 0;

    int temp2 = 0;

    linkedlist pokelisttemp = new linkedlist();

    for(int i=0; i<this.pokelist.size(); i++){

      temp1 = (int)(math.random()*100)%51;//取1-52之间的随机数

      while(temp2 == temp1)

        temp1 = (int)(math.random()*100)%51;//如果出现重复的随机数,重新取

      pokelisttemp.add(i,this.pokelist.get(temp1));//依次将乱序的pokedata对象插入

      temp2 = temp1;

    }

    setuserlinklist(pokelisttemp);

  }


...   下一页
    摘要:j2ee frameworkspring 1.1.4, ofbiz 3.0.0 persistence frameworkhibernate 2.1.8 , ibatis 2.0.9 web frameworkstruts 1.2.4 , tapestry 3.0.1 , webwork2 2.1.7 , echo 1.1.4 riaflex 1.5(商业) , laszlo ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE