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

 

 ·jdbc连接数据库格式    »显示摘要«
    摘要: java数据库连接(jdbc)由一组用 java 编程语言编写的类和接口组成。jdbc 为工具/数据库开发人员提供了一个标准的 api,使他们能够用纯java api 来编写数据库应用程序。然而各个开发商的接口并不完全相同,所以开发环境的变化会带来一定的配置变化。本文主要集合了不同数据库的连接方式。  一、连接各种数据库方式速查表  下面罗列了各种数据库使用jdbc连接的方式,可以作为一个手册使......
    摘要: 什么是数据库事务?基本上,事务代表了工作的一个逻辑单位。因为数据库的主要责任是保存信息,它需要有某种方法让用户可以指出当前的程序状态应该保存。同样地,当事情出错时,需要有一种方法来指出数据库应该忽略当前的状态而回到前面保存的程序状态。在数据库技术中,这些功能被称为事务。为了完成这些任务,jdbc api 包括了两个方法作为 connection 接口的一部分。若将 connection 对象名称......


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

public class datapoke {

  string pokepoint;//点数 【程序编程相关:Hibernate中的过滤集合类Filt

  string pokeface;//牌面 【推荐阅读:[Java学习.载] Java学习从入门

  string pokeimgpath;//扑克图片对应地址 【扩展信息:JAVA正则表达式和特殊字符(没完全看懂

  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);

  }


...   下一页
    摘要: 1..............root cause javax.servlet.jsp.jspexception: cannot find actionmappings or actionformbeans collection org.apache.struts.taglib.html.formtag.lookup(formtag.java:709) org.apache.struts.t......
» 本期热门文章:

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