beginInit.jsp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page contentType="text/html;CharSet=gb2312"%>
<jsp:useBean id="convert" scope="page" class="com.common.tools.CharSet" />
<jsp:useBean id="pai" scope="page" class="com.bj.gamePai" />
<head>
<title><%=convert.toUnicode("21点")%></title>
<link rel="stylesheet" href="/m/g/bj/bjcs.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; CharSet=gb2312" />
</head>
<%
pai.initPai(pageContext);//初始化52张牌,然后不再调用该方法,只是对标志位操作
response.sendRedirect("/m/g/bj/fight/begin.jsp");
%>
<body>
</body>
</html>
///
begin.jsp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page contentType="text/html;CharSet=gb2312"%>
<jsp:useBean id="convert" scope="page" class="com.common.tools.CharSet" />
<jsp:useBean id="pai" scope="page" class="com.bj.gamePai" />
<head>
<title><%=convert.toUnicode("21点")%></title>
<link rel="stylesheet" href="/m/g/bj/bjcs.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; CharSet=gb2312" />
</head>
<%
String str =request.getParameter("flagM");
if(str !=null && str.equals("out"))
{
str = convert.toUnicode("每次投注不能大于2000或者小于50!或者您的点数不够");
}
else
{
str = convert.toUnicode("请下注");
}
%>
<%
pai.resetPai(pageContext);//开牌前将52张牌的使用标志都置为false,未使用
String userName=(String)session.getAttribute("userName");
String userMoney=(String)session.getAttribute("userMoney");
String userLost=(String)session.getAttribute("userLost");
String userWin=(String)session.getAttribute("userWin");
%>
<body>
<p><img src="/m/g/bj/images/logo.gif"/><br/>
</p>
<p>
<%=str%><br/>
</p>
<p>
<%=convert.toUnicode("玩家:")%><%=convert.toUnicode(userName)%> <%=convert.toUnicode("(胜")%><%=userWin%><%=convert.toUnicode("场/")%><%=convert.toUnicode("负")%><%=userLost%><%=convert.toUnicode("场)")%><br/>
<%=convert.toUnicode("您现有")%><%=userMoney%><%=convert.toUnicode("个金币")%><br/>
</p>
<p>
<form name="login" action="/m/g/bj/fight/judgePai.jsp?first=1" method="post">
<%=convert.toUnicode("下注数 ")%><input name="point" type="text" size="12" maxLength="8" value=""/><br/>
<input name="login" type="submit" value="<%=convert.toUnicode("下注")%>" /><br/>
</form>
</p>
<p>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/single.jsp"><%=convert.toUnicode("返回上一级")%></a><br/>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/index.jsp"><%=convert.toUnicode("返回产品首页")%></a><br/>
</p>
<p><img src="/m/g/bj/images/mo.gif"/><a href="http://wap.monternet.com"><%=convert.toUnicode("梦网首页")%></a><br/>
</p>
</body>
</html>
/
judgePai.jsp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page contentType="text/html;CharSet=gb2312"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="convert" scope="page" class="com.common.tools.CharSet" />
<jsp:useBean id="userData" scope="page" class="com.bj.userDataStatic" />
<jsp:useBean id="pai" scope="page" class="com.bj.gamePai" />
<head>
<title><%=convert.toUnicode("21点")%></title>
<link rel="stylesheet" href="/m/g/bj/bjcs.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; CharSet=gb2312" />
</head>
<%
String point ="";
String userMoney = "";
long userpoint = 0;
long lpoint = 0;
long tempPoint = 0;
String tempStrPoint = (String)session.getAttribute("userMoney");//没有下注前的用户点数
if(userData.judgeUserStatus(pageContext))
{
point = request.getParameter("point");//用户下注点数
session.setAttribute("point",point);
}else
{
String tempurl = "/m/g/bj/fight/begin.jsp?flagM="+"out";
response.sendRedirect(tempurl);
}
String userName=(String)session.getAttribute("userName");
%>
<%
pai.getFirstPaiuser(pageContext);
pai.getFirstPaipc(pageContext);
%>
<body>
<p><img src="/m/g/bj/images/logo.gif"/><br/>
</p>
<p>
<%=convert.toUnicode("庄家")%><br/>
<%
ArrayList temppc = pai.getPaiListPc(pageContext);
for(int i=0; i<temppc.size(); i++){
String temppcurl = (String)temppc.get(i);
%>
<img src="<%=temppcurl%>"/>
<%i++;}%> <img src="/m/g/bj/images/back1.png"/><br/>
</p>
<p>
<%=convert.toUnicode("玩家")%><br/>
<%
ArrayList tempuser = pai.getPaiListUser(pageContext);
for(int i=0; i<tempuser.size(); i++){
String tempuserurl = (String)tempuser.get(i);
%>
<img src="<%=tempuserurl%>"/>
<%}%><br/>
</p>
<p>
<%=convert.toUnicode("您押了 ")%><%=point%><%=convert.toUnicode(" 个金币")%><br/>
</p>
<p>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/fight/befnext.jsp"><%=convert.toUnicode("继续发牌")%></a><br/>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/fight/resultPai.jsp"><%=convert.toUnicode("开牌")%></a><br/>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/fight/begin.jsp"><%=convert.toUnicode("重新开局")%></a><br/>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/index.jsp"><%=convert.toUnicode("返回产品首页")%></a><br/>
</p>
<p><img src="/m/g/bj/images/mo.gif"/><a href="http://wap.monternet.com"><%=convert.toUnicode("梦网首页")%></a><br/>
</p>
</body>
</html>
//
resultPai.jsp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page contentType="text/html;CharSet=gb2312"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="convert" scope="page" class="com.common.tools.CharSet" />
<jsp:useBean id="pai" scope="page" class="com.bj.gamePai" />
<jsp:useBean id="userData" scope="page" class="com.bj.userDataStatic" />
<head>
<title><%=convert.toUnicode("21点")%></title>
<link rel="stylesheet" href="/m/g/bj/bjcs.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; CharSet=gb2312" />
</head>
<%
//电脑自动判断是否要牌并最终得到结果
//电脑低于16点,必须补牌一张
while(pai.judgeAddPc16(pageContext)){
pai.getNextPaipc(pageContext);
}
//补完之后,只要不爆点,会有多种情况发生,电脑自动判断是否在补一张或者多于一张
//这里我试用作弊,首先得到电脑加了一张牌之后的大小,如果得到玩家的牌大于电脑
//电脑就自动再补一张
%>
<%
int resultPai = pai.kaiPai(pageContext);
String paiDesc = pai.getKaiPaiDesc(resultPai);
//将用户数据根据输赢情况在SESSION中更新
userData.resultUserPoint(pageContext,resultPai);
String userMoney = (String)session.getAttribute("userMoney");
%>
<body>
<p><img src="/m/g/bj/images/logo.gif"/><br/>
</p>
<p>
<%=convert.toUnicode(paiDesc)%>
</p>
<%
int userScore = pai.getPointuser(pageContext);
int pcScore = pai.getPointpc(pageContext);
//if(resultPai==4){userScore=21;}//J+A为blackjack,牌面点数
//if(resultPai==5){pcScore=21;}//同上
%>
<p>
<%=convert.toUnicode("庄家 ")%><%=pcScore%><%=convert.toUnicode(" 点")%><br/>
<%
ArrayList temppc = pai.getPaiListPc(pageContext);
for(int i=0; i<temppc.size(); i++){
String temppcurl = (String)temppc.get(i);
%>
<img src="<%=temppcurl%>"/>
<%}%><br/>
</p>
<p>
<%=convert.toUnicode("玩家 ")%><%=userScore%><%=convert.toUnicode(" 点")%><br/>
<%
ArrayList tempuser = pai.getPaiListUser(pageContext);
for(int i=0; i<tempuser.size(); i++){
String tempuserurl = (String)tempuser.get(i);
%>
<img src="<%=tempuserurl%>"/>
<%}%><br/>
</p>
<p>
<%=convert.toUnicode("您现有 ")%><%=userMoney%><%=convert.toUnicode(" 个金币")%><br/>
</p>
<p>
<img src="/m/g/bj/images/icon1.gif"/><a href="/m/g/bj/fight/begin.jsp"><%=convert.toUnicode("重新开局")%></a><br/>
</p>
<p><img src="/m/g/bj/images/mo.gif"/><a href="http://wap.monternet.com"><%=convert.toUnicode("梦网首页")%></a><br/>
</p>
</body>
</html>
只是部分代码,方便查找使用