--创建SelfStudy数据库 CREATE DATABASE ConstructionDB ON PRIMARY --创建主数据库文件 ( NAME=' ConstructionDB', --数据文件的物理名称 FILENAME='D:Project ConstructionDB.dbf', --数据文件的名称和路径 SIZE=5MB, --数据文件的初始容量 MaxSize=20MB, --数据文件的最大容量 FileGrowth=1MB --数据文件的增长量 ) LOG ON --创建日志文件 ( NAME='ConstructionDB', --数据文件的逻辑名称 FileName='D:Project ConstructionDB.ldf', --数据文件的名称和路径 Size=2MB, --数据文件的初始容量 MaxSize=20MB, --数据文件的最大容量 FileGrowth=1MB --数据文件的增长量 ) GO use ConstructionDB go ---3.2 创建数据表 create table T_enterprise_info( Ent_id char(32) not null, -- 企业编号 主键 Ent_name varchar(32) not null, --企业名称 Begin_date datetime, --建立时间 --日期型 Addr varchar(64) ,--详细地址 Reg_capital decimal(12,4),--注册资本 数值型,单位:万元 ) --插入数据 insert into T_enterprise_info select '200200078','长沙城建有限公司','2002-01-01','长沙市天心区',1000 union all select '200400005','天信建筑企业有限公司','2004-01-01','长沙市芙蓉区',1500 --设置主键 alter table T_enterprise_info add constraint pk_T_enterprise_info_Ent_id primary key(Ent_id) select * from T_enterprise_info
表格:
project_add:
<%@ page language="java" import="java.util.*" 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 'project_add.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> <script language="javascript"> function check(){ var inputs = document.getElementsByTagName('input'); for(var i=0,len=2;i<len;i++){ if(inputs[i].value == ''){ alert('必填项不能为空!'); inputs[i].focus(); return false; } } return true; } </script> <body> <table width="834" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="30" background="images/title01.jpg" class="title">>>项目信息录入</td> <td width="27" height="30"><img src="images/title02.jpg" width="27" height="30" /></td> <td height="30" bgcolor="#029AC5" class="txt">您的位置:招投标流程 > 建设工程报建 > 项目信息录入</td> </tr> </table> <br /> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="100%" height="30" bgcolor="#80C6FF" class="titletxt">•建设工程报建—项目信息录入(以下带<span class="txtred">*</span>为必填项)</td> </tr> <tr> <td height="30" align="center"><form id="form1" name="form1" method="post" action="AddProjectServlet" onsubmit="return check()" > <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#E7E7E7"> <tr> <td width="24%" height="30" align="right" class="txt"><span class="txt">工程编号:</span></td> <td height="30" align="left"><label for="textfield"></label> <input height="20" width="400" type="text" name="textfield1" id="textfield" /> <span class="txtred">*</span></td> </tr> <tr> <td width="24%" height="30" align="right" class="txt"><span class="txt">工程名称:</span></td> <td height="30" align="left"><input height="20" width="400" type="text" name="textfield2" id="textfield2" /> <span class="txtred">*</span></td> </tr> <tr> <td height="30" align="right" class="txt">法人代表:</td> <td height="30" align="left"><input height="20" width="150" type="text" name="textfield3" id="textfield3" /></td> </tr> <tr> <td height="30" align="right" class="txt">建设单位电话:</td> <td height="30" align="left"><input height="20" width="200" type="text" name="textfield4" id="textfield4" /></td> </tr> <tr> <td height="30" align="right" class="txt">建设单位地址:</td> <td height="30" align="left"><span class="txtred"> <input height="20" width="400" type="text" name="textfield5" id="textfield5" /> </span></td> </tr> </table> <p><input type="submit" name="button" id="button" value=" 确 定 " /></p> </form> <p> </p></td> </tr> </table> <p> </p> </body> </html>
project_list
<%@ page language="java" import="java.util.*,biz.*,entity.*" 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 'project_list.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> <table width="834" border="0" cellpadding="0" cellspacing="0"> <% ProjectBiz pb=new ProjectBizImpl(); ArrayList<Project> list=pb.getProjects(); Project p=null; %> <tr> <td height="30" background="images/title01.jpg" class="title">>>项目信息录入</td> <td width="27" height="30"><img src="images/title02.jpg" width="27" height="30" /></td> <td height="30" bgcolor="#029AC5" class="txt">您的位置:招投标流程 > 建设工程报建 > 项目信息录入</td> </tr> </table> <br /> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="33%" height="37"> </td> <td width="34%" height="37"> </td> <td width="33%" height="37" align="right" valign="top"><a href="project_add.jsp" target="_self"><img src="images/addpro.JPG" border="0" /></a> </td> </tr> <tr> <td height="30" colspan="3" bgcolor="#029AC5" class="titletxt">•项目信息</td> </tr> <tr> <td height="30" colspan="3"><table width="100%" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="33%" height="30" align="center" bgcolor="#80C6FF"><span class="txt"><span class="titletxt">工程编号</span></span></td> <td width="34%" height="30" align="center" bgcolor="#80C6FF" class="titletxt">工程名称</td> <td width="33%" height="30" align="center" bgcolor="#80C6FF" class="titletxt">相关操作</td> </tr> <% for(int i=0;i<list.size();i++){ p=list.get(i); %> <tr> <td width="33%" height="30" align="center" bgcolor="#FFF5D7"><span class="txt"><%=p.getProject_id() %></span></td> <td width="34%" height="30" align="center" bgcolor="#FFF5D7"><span class="txt"><%=p.getProject_name() %></span></td> <td width="33%" height="30" align="center" bgcolor="#FFF5D7"><span class="txt">【修改】【删除】</span></td> </tr> <% } %> </table></td> </tr> </table> <p> </p> </body> </html>