我数据库用的MySQ,JSP页面和相关的java代码也都写好了,应该没什么问题。只差建表了,该怎么写啊?其中一段代码是这样的:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gbk"%>
<%
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 href="<%=basePath%>">
<title>My JSP 'result.jsp' starting page</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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<center>
<table width="70%" border="5">
<tr><td>ID</td><td>标题</td><td>内容</td><td>时间</td><td>修改</td><td>删除</td></tr>
<%
request.setCharacterEncoding("GB2312");
ResultSet rs = (ResultSet)request.getAttribute("result");
while(rs.next())
{
//String oldtitle = (String)request.getAttribute(rs.getString("title"));
//String olddetail = (String)request.getAttribute(rs.getString("detail"));
%>
<tr><td><%=rs.getInt("id") %></td><td><%=rs.getString("title") %></td><td><%=rs.getString("detail") %></td><td><%=rs.getString("time") %></td>
<td><a href="./MemoProcess?action=edit&id=<%=rs.getString("title") %>">修改</a></td><td><a href="./MemoProcess?action=delete&id=<%=rs.getString("title") %>">删除</a></td></tr>
<%
}
%>
</table>
</center>
</body>
</html>
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gbk"%>
<%
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 href="<%=basePath%>">
<title>My JSP 'result.jsp' starting page</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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<center>
<table width="70%" border="5">
<tr><td>ID</td><td>标题</td><td>内容</td><td>时间</td><td>修改</td><td>删除</td></tr>
<%
request.setCharacterEncoding("GB2312");
ResultSet rs = (ResultSet)request.getAttribute("result");
while(rs.next())
{
//String oldtitle = (String)request.getAttribute(rs.getString("title"));
//String olddetail = (String)request.getAttribute(rs.getString("detail"));
%>
<tr><td><%=rs.getInt("id") %></td><td><%=rs.getString("title") %></td><td><%=rs.getString("detail") %></td><td><%=rs.getString("time") %></td>
<td><a href="./MemoProcess?action=edit&id=<%=rs.getString("title") %>">修改</a></td><td><a href="./MemoProcess?action=delete&id=<%=rs.getString("title") %>">删除</a></td></tr>
<%
}
%>
</table>
</center>
</body>
</html>
(
id int identity(1,1) primary key,
title varchar(30),
time varchar(30),
detail varchar(100)
)