servlet運行不了,正則表達式增刪改查組合查詢,中文亂碼JDBC游戲管理系統(tǒng)JSP詩書畫唱






--drop table game
--select * from game
create table game(
id int primary key auto_increment,
gname varchar(100) ,
gtype varchar(100) ,
gcompany varchar(100) ,
gyear int);
--gyear varchar(100)
--'詩書畫唱游戲發(fā)行年份1'
insert into game(
gname,
gtype ,
gcompany ,
gyear
) values ("詩書畫唱游戲1","詩書畫唱游戲類型1",'詩書畫唱好公司1',6666),
("詩書畫唱游戲2","詩書畫唱好游戲類型2",'詩書畫唱好公司2',8888),
("詩書畫唱好游戲3","詩書畫唱好游戲類型3",'詩書畫唱公司3',2333),
("詩書畫唱好游戲4","詩書畫唱游戲類型4",'詩書畫唱公司4',7758);




package com.SSHC.bean;
//這個類叫bean類,用來存放對應表中的數(shù)據(jù)的
//這個類的名字跟對應的表的名字是一樣的,但是首字母必須大寫
//這個類中的屬性名與表中的列名是一致的
public class Game {
? ? private Integer id;//游戲編號
? ? private String gname;//游戲名稱
? ? private String gtype;//游戲類型
? ? private String gcompany;//游戲公司
? ? private Integer gyear;//游戲年份
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getGname() {
return gname;
}
public void setGname(String gname) {
this.gname = gname;
}
public String getGtype() {
return gtype;
}
public void setGtype(String gtype) {
this.gtype = gtype;
}
public String getGcompany() {
return gcompany;
}
public void setGcompany(String gcompany) {
this.gcompany = gcompany;
}
public Integer getGyear() {
return gyear;
}
public void setGyear(Integer gyear) {
this.gyear = gyear;
}
}


package com.SSHC.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.SSHC.DAO.GameDao;
import com.SSHC.bean.Game;
/**
?* Servlet implementation class addOKServlet
?*/
@WebServlet("/addOKServlet")
public class addOKServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
? ? /**
? ? ?* @see HttpServlet#HttpServlet()
? ? ?*/
? ? public addOKServlet() {
? ? ? ? super();
? ? ? ? // TODO Auto-generated constructor stub
? ? }
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//亂碼處理:
? ? request.setCharacterEncoding("utf-8");
? ? //1、獲取表單中輸入的數(shù)據(jù):
? ? String? gname = request.getParameter("gname");
? ? String gtype= request.getParameter("gtype");
? ? String gcompany= request.getParameter("gcompany");
String gyear = request.getParameter("gyear");
? // Integer gyear2=Integer.valueOf(gyear);
Integer gyearInteger=0;
if(gyear != null && gyear.length() > 0) {
gyearInteger =Integer.valueOf(gyear);
}
? ? Game u = new Game();
? ? u.setGname(gname);
? ? u.setGtype(gtype);
?
? ? u.setGcompany(gcompany);
? ?u.setGyear(gyearInteger);
? ?
? ? ??
GameDao ud = new GameDao();
? ud.add(u);
? ?
//Integer count = ud.add(u);
String S=null;
? ? if(u.getGname()!=null) {
? S="添加成功!";
? ? }else?
? ? {
? ? S="添加失敗!";
? ? }??
? //將html代碼傳到gamelist.jsp頁面去
? request.setAttribute("S", S);
? //跳轉到gamelist.jsp頁面
? request.getRequestDispatcher("addOK.jsp")
? ? ? .forward(request, response);
}
}


package com.SSHC.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.SSHC.DAO.GameDao;
import com.SSHC.bean.Game;
/**
?* Servlet implementation class GameListServ
?*/
@WebServlet("/gameList")
public class GameListServ extends HttpServlet {
private static final long serialVersionUID = 1L;
? ? ? ?
? ? /**
? ? ?* @see HttpServlet#HttpServlet()
? ? ?*/
? ? public GameListServ() {
? ? ? ? super();
? ? ? ? // TODO Auto-generated constructor stub
? ? }
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//亂碼處理
request.setCharacterEncoding("utf-8");
//獲取到用戶輸入的查詢條件
String gname = request.getParameter("gname");
String gtype = request.getParameter("gtype");
String gcomp = request.getParameter("gcompany");
String strYear = request.getParameter("gyear");
//將字符串strYear轉換成Integer
Integer gyear = -1;
if(strYear != null && strYear.length() > 0) {
gyear = Integer.parseInt(strYear);
}
//將查詢條件打包
Game gm = new Game();
gm.setGname(gname);
gm.setGtype(gtype);
gm.setGcompany(gcomp);
gm.setGyear(gyear);
//根據(jù)條件進行查詢
GameDao gd = new GameDao();
List<Game>list = gd.selectByCond(gm);
//拼接html字符串
StringBuilder html = new StringBuilder();
for(Game g : list) {
String gn = g.getGname();
String gt = g.getGtype();
String gc = g.getGcompany();
Integer gy = g.getGyear();
html.append("<tr>");
? ? ? ? html.append("<td>" + gn + "</td>");
? ? ? ? html.append("<td>" + gt + "</td>");
? ? ? ? html.append("<td>" + gc + "</td>");
? ? ? ? html.append("<td>" + gy + "</td>");
? ? ? ? html.append("</tr>");
}
//將html代碼傳到gamelist.jsp頁面去
request.setAttribute("html", html);
//跳轉到gamelist.jsp頁面
request.getRequestDispatcher("gamelist.jsp")
? ? .forward(request, response);
}
}


package com.SSHC.DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.SSHC.bean.Game;
import com.SSHC.utils.DBUtils;
//類名就是對應的bean的名字后面加上Dao
//Dao就是數(shù)據(jù)訪問類的意思,就是對Game表進行增刪改查的代碼都寫在這個類中
public class GameDao {
? ? public List<Game>selectAll(){
? ? Connection conn = null;
? ? PreparedStatement pstm = null;
? ? ResultSet rs = null;
? ? String sql = "select * from game";
? ? //存放查詢結果的容器
? ? List<Game>list = new ArrayList<Game>();
? ? try {
? ? ? ? conn = DBUtils.getConn();
pstm = conn.prepareStatement(sql);
rs = pstm.executeQuery();
while(rs.next()) {
Integer id = rs.getInt("id");
String gname = rs.getString("gname");
String gtype = rs.getString("gtype");
String gcomp = rs.getString("gcompany");
Integer gyear = rs.getInt("gyear");
//數(shù)據(jù)打包
Game g = new Game();
g.setId(id);
g.setGname(gname);
g.setGtype(gtype);
g.setGcompany(gcomp);
g.setGyear(gyear);
list.add(g);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
//清理資源
DBUtils.close(rs, pstm, conn);
}
? ? return list;
? ? }
? ??
? ? //組合查詢
? ? public List<Game>selectByCond(Game g){
? ? //定義一個存放參數(shù)的容器
? ? List<Object>params = new ArrayList<Object>();
? ? //根據(jù)g中的條件來拼接出sql語句
? ? StringBuilder sql = new StringBuilder();
? ? sql.append("select * from game where 1=1 ");
? ? String gn = g.getGname();
? ? if(gn != null && gn.trim().length() > 0) {
? ? sql.append("and gname like ? ");
? ? params.add("%" + gn + "%");
? ? }
? ? String gt = g.getGtype();
? ? if(gt != null && gt.trim().length() > 0) {
? ? sql.append("and gtype like ? ");
? ? params.add("%" + gt + "%");
? ? }
? ? String gc = g.getGcompany();
? ? if(gc != null && gc.trim().length() > 0) {
? ? sql.append("and gcompany like ? ");
? ? params.add("%" + gc + "%");
? ? }
? ? Integer gy = g.getGyear();
? ? if(gy != null && gy > 0) {
? ? sql.append("and gyear = ? ");
? ? params.add(gy);
? ? }
? ? Connection conn = null;
? ? PreparedStatement pstm = null;
? ? ResultSet rs = null;
? ? //存放查詢結果的容器
? ? List<Game>list = new ArrayList<Game>();
? ? try {
? ? ? ? conn = DBUtils.getConn();
pstm = conn.prepareStatement(sql.toString());
//設置參數(shù)
for(int i = 0;i < params.size();i ++) {
pstm.setObject(i + 1, params.get(i));
}
rs = pstm.executeQuery();
while(rs.next()) {
Integer id = rs.getInt("id");
String gname = rs.getString("gname");
String gtype = rs.getString("gtype");
String gcomp = rs.getString("gcompany");
Integer gyear = rs.getInt("gyear");
//數(shù)據(jù)打包
Game gm = new Game();
gm.setId(id);
gm.setGname(gname);
gm.setGtype(gtype);
gm.setGcompany(gcomp);
gm.setGyear(gyear);
list.add(gm);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
//清理資源
DBUtils.close(rs, pstm, conn);
}
? ? return list;
? ? }
? ??
?public Integer add(Game? u) {
??
? ? String sql = "insert into game(gname ,gtype "
+ ",gcompany ,gyear) values (?,?,?,?);";
? ? Connection conn = null;
? ? PreparedStatement pstm = null;
? ? ResultSet rs = null;
//? ? gname,
//
//? ? gtype ,
//? ? gcompany ,
//
//? ? gyear
? ? try {
? ? ? ? conn = DBUtils.getConn();
pstm = conn.prepareStatement(sql);
//設置占位符
//System.out.println(u.getAct());
pstm.setObject(1,u.getGname());
pstm.setObject(2,u.getGtype() );
pstm.setObject(3,u.getGcompany ());
pstm.setObject(4, u.getGyear());
pstm.executeUpdate();
? ? ? ? } catch (SQLException e) {
? ? ? ? ? ? // TODO Auto-generated catch block
? ? ? ? ? ? e.printStackTrace();
? ? ? ? }finally{
?
? ? ? ? ? ?
DBUtils.close(rs, pstm, conn);
}
? ? return 0;
? ? }
}


package com.SSHC.utils;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
public class DBUtils {
? ? private static String driverName;
? ? private static String url;
? ? private static String userName;
? ? private static String pwd;
? ? //靜態(tài)塊,隨著類加載而運行的
? ? static{
? ? //讀取db.properties文件中的內(nèi)容
? ? Properties prop = new Properties();
? ? InputStream is = DBUtils.class.getClassLoader()
? ? .getResourceAsStream("db.properties");
? ? try {
prop.load(is);
driverName = prop.getProperty("dn");
url = prop.getProperty("url");
userName = prop.getProperty("un");
pwd = prop.getProperty("up");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
? ? }
? ??
? ? public static Connection getConn(){
? ? Connection conn = null;
? ? try {
Class.forName(driverName);
conn = DriverManager.getConnection(url,userName,pwd);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
? ? return conn;
? ? }
? ??
? ? public static void close(ResultSet rs,PreparedStatement pstm
? ? ,Connection conn){
? ? try {
? ? if(rs != null) {
? ? rs.close();
? ? }
? ? if(pstm != null) {
? ? pstm.close();
? ? }
? ? if(conn != null) {
? ? conn.close();
? ? }
? ? } catch(Exception e) {
? ? e.printStackTrace();
? ? }
? ? }
}


dn=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/firstjsp?useUnicode=true&characterEncoding=UTF-8
un=root
up=root


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? ? ? <style type="text/css">
? ? ? ? ? ? * {
? ? ? ? ? ? ? ? font-size: 50px;
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ? .inp {
? ? ? ? ? ? ? ? box-shadow: 5px 5px 5px #888888;
? ? ? ? ? ? ? ? border: 0px;
? ? ? ? ? ? ? ? border-radius: 5px;
? ? ? ? ? ? }
? ? ? ? </style>
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? function cancel(){
? ? ? ? ? ? window.location.href = 'gameinfo.jsp';
? ? ? ? ? ? }
? ? ? ? ??
? ? ? ? ?
? ? ? ? ? ? //表單驗證的方法
? ? ? ? ? ? function doCheck(){
? ? ? ? ? ? //獲取輸入的年份
? ? ? ? ? ? var year = document.getElementsByName('gyear')[0].value;
? ? ? ? ? ? //判斷year是一個四位的數(shù)字
? ? ? ? ? ? //\d表示0到9的數(shù)字,{4}表示可以有4個這樣的數(shù)字
? ? ? ? ? ? //^以數(shù)字開頭,$表示以數(shù)字結尾
? ? ? ? ? ? var reg = /^\d{4}$/;
? ? ? ? ? ? //如果year是一個四位數(shù)字,那么r就為true,否則就為false
? ? ? ? ? ? var r = reg.test(year);
? ? ? ? ? ? if(!r) {
? ? ? ? ? ? alert('請輸入四位數(shù)字');
? ? ? ? ? ? }
? ? ? ? ? ? return r;
? ? ? ? ? ? }
? ??
? ? ? ? </script>
? ? </head>
? ? <body>
? ? ? ? <table style="width:100%;">
? ? ? ? ? ? <tr>
?<td style="background-color:gray;text-align:center;">游戲新增</td>
? ? ? ? ? ? </tr>
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td align="center">
? ? ? ? ? ? ? ? ? ?<%--<form action="addOK.jsp" method="post"> --%>?
? ? ? ? ? ? ? ? ? ?<form action="addOKServlet" method="post" onsubmit="return doCheck();">
? ? ? ? ? ? ? ? ? ? <table>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>游戲名稱:</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>
? <input class="inp" type="text" name="gname" />
? ? ? <span style="color:red;">*</span>
? ? ? ? ? ? ? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>游戲類型:</td>
<td><input class="inp" type="text" name="gtype" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>發(fā)行公司:</td>
?<td><input class="inp" type="text" name="gcompany" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>發(fā)行年份:</td>
<td><input class="inp" type="text" name="gyear"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? placeholder="四位數(shù)字" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td colspan="2" align="center">
? <input type="submit" value="添加" onclick='doCheck();' />
?<input type="button" value="返回" onclick="cancel();" />
? ? ? ? ? ? ? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? </table>
? ? ? ? ? ? ? ? ? ? </form>
? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? </tr>
? ? ? ? </table>
? ? </body>
</html>


<%@ page language="java" contentType=
"text/html; charset=utf-8"
? ? pageEncoding="utf-8"%>
? ? <%@page import="com.SSHC.bean.Game"%>
? ? ? <%@page import="com.SSHC.DAO.GameDao"%>
? ? <%--
? ? ?<%
? ? //亂碼處理:
? ? request.setCharacterEncoding("utf-8");
? ? //1、獲取表單中輸入的數(shù)據(jù):
? ? String? gname = request.getParameter("gname");
? ? String gtype= request.getParameter("gtype");
? ? String gcompany= request.getParameter("gcompany");
?String gyear = request.getParameter("gyear");
? // Integer gyear2=Integer.valueOf(gyear);
? Integer gyearInteger=0;
if(gyear != null && gyear.length() > 0) {
gyearInteger =Integer.valueOf(gyear);
}
? ? Game u = new Game();
? ? u.setGname(gname);
? ? u.setGtype(gtype);
?
? ? u.setGcompany(gcompany);
? ?u.setGyear(gyearInteger);
? ?
? ? ??
GameDao ud = new GameDao();
? ud.add(u);
? ?
?//Integer count = ud.add(u);
?String S=null;
? ? if(u.getGname()!=null) {
? S="添加成功!";
? ? }else?
? ? {
? ? S="添加失敗!";
? ? }??
%>
--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
?Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
${S };
</body>
</html>


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? ? ? <style type="text/css">
? ? ? ? ? ? * {
? ? ? ? ? ? ? ? font-size: 50px;
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ? .inp {
? ? ? ? ? ? ? ? box-shadow: 5px 5px 5px #888888;
? ? ? ? ? ? ? ? border: 0px;
? ? ? ? ? ? ? ? border-radius: 5px;
? ? ? ? ? ? }
? ? ? ? </style>
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? function toAdd(){
? ? ? ? ? ? window.location.href = 'add.jsp';
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ? //表單驗證的方法
? ? ? ? ? ? function doCheck(){
? ? ? ? ? ? //獲取輸入的年份
? ? ? ? ? ? var year = document.getElementsByName('gyear')[0].value;
? ? ? ? ? ? //判斷year是一個四位的數(shù)字
? ? ? ? ? ? //\d表示0到9的數(shù)字,{4}表示可以有4個這樣的數(shù)字
? ? ? ? ? ? //^以數(shù)字開頭,$表示以數(shù)字結尾
? ? ? ? ? ? var reg = /^\d{4}$/;
? ? ? ? ? ? //如果year是一個四位數(shù)字,那么r就為true,否則就為false
? ? ? ? ? ? var r = reg.test(year);
? ? ? ? ? ? if(!r) {
? ? ? ? ? ? alert('請輸入四位數(shù)字');
? ? ? ? ? ? }
? ? ? ? ? ? return r;
? ? ? ? ? ? }
? ? ? ? </script>
? ? </head>
? ? <body>
? ? ? ? <table style="width:100%;">
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td style="background-color:gray;text-align:center;">游戲查詢</td>
? ? ? ? ? ? </tr>
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td align="center">
?<!-- action中的路徑都配置成servlet,通過servlet來進行頁面的跳轉 -->
<form action="gameList" method="post" onsubmit="return doCheck();">
? ? ? ? ? ? ? ? ? ? <table>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>游戲名稱:</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><input class="inp" type="text" name="gname" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>游戲類型:</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><input class="inp" type="text" name="gtype" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>發(fā)行公司:</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><input class="inp" type="text" name="gcomp"/></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>發(fā)行年份:</td>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><input class="inp" type="text" name="gyear"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? placeholder="四位數(shù)字" /></td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <td colspan="2" align="center">
? ? ? ?<input type="submit" value="查詢" />
? ? ? ? <input type="button" value="新增" onclick="toAdd();" />
? ? ? ? ? ? ? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? </table>
? ? ? ? ? ? ? ? ? ? </form>
? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? </tr>
? ? ? ? </table>
? ? </body>
</html>



<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
? ? String path = request.getContextPath();
? ? String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? ? <head>
? ? ? ? <base hreff="<%=basePath%>">
? ? ? ? <title></title>
? ? ? ? <meta http-equiv="pragma" content="no-cache">
? ? ? ? <meta http-equiv="cache-control" content="no-cache">
? ? ? ? <meta http-equiv="expires" content="0">
? ? ? ? <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
? ? ? ? <meta http-equiv="description" content="This is my page">
? ? ? ? <style type="text/css">
? ? ? ? ? ? * {
? ? ? ? ? ? ? ? font-size: 50px;
? ? ? ? ? ? }
? ? ? ? </style>
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? function bk(){
? ? ? ? ? ? window.location.href = 'gameinfo.jsp';
? ? ? ? ? ? }
? ? ? ? </script>
? ? </head>
? ? <body>
? ? ? ? <table style="width:100%;" border="1">
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td><a hreff="javascript:bk()" style="float:right;">返回</a></td>
? ? ? ? ? ? </tr>
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td style="background-color:gray;text-align:center;">游戲列表</td>
? ? ? ? ? ? </tr>
? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? <td>
? ? ? ? ? ? ? ? ? ? <table border="1" style="width:100%;">
? ? ? ? ? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <th>游戲名稱</th>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <th>游戲類別</th>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <th>發(fā)行公司</th>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <th>發(fā)行時間</th>
? ? ? ? ? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? ? ? ? ? ${html }
? ? ? ? ? ? ? ? ? ? </table>
? ? ? ? ? ? ? ? </td>
? ? ? ? ? ? </tr>
? ? ? ? </table>
? ? </body>
</html>










