J2EE 企业应用开发开发环境.ppt
J2EE 企业应用开发开发环境,刘持标数学与计算机科学系2011年3月,Java SE Development Kit 安装(1),Java SE Development Kit 安装(2),Java SE Development Kit 安装(3),Java SE Development Kit 安装(4),Java SE Development Kit 安装(5),Java SE Development Kit 安装(6),可以忽略注册,关闭窗口,Windows XP JAVA_HOME、JRE_HOME 配置(1),Windows XP JAVA_HOME、JRE_HOME 配置(2),Windows XP JAVA_HOME、JRE_HOME 配置(3),Windows 7 JAVA_HOME、JRE_HOME 配置(1),Windows 7 JAVA_HOME、JRE_HOME 配置(2),Windows 7 JAVA_HOME、JRE_HOME 配置(3),Windows 7/XP JAVA_HOME、JRE_HOME 配置(1),JAVA_HOME C:Program FilesJavajdk1.6.0_23JRE_HOME C:Program FilesJavajre6,Windows 7/XP JAVA_HOME、JRE_HOME 配置(2),Windows 7/XP JAVA_HOME、JRE_HOME 配置(3),安装MySql Database(1),安装MySql Database(2),安装MySql Database(3),安装MySql Database(4),安装MySql Database(5),Instance and database,The terms instance and database are closely related,but dont refer to the same thing.The database is the set of files where application data and meta data is stored.An instance is the software(and memory)that MySql or other DB software uses to manipulate the data in the database.In order for the instance to be able to manipulate that data,the instance must open the database.A database can be opened(or mounted)by more than one instance,however,an instance can open at most one database.,安装MySql Database(6),安装MySql Database(7),安装MySql Database(8),安装MySql Database(9),InnoDB 给 MySQL 提供了具有事务(transaction)、回滚(rollback)和崩溃修复能力(crash recovery capabilities)、多版本并发控制(multi-versioned concurrency control)的事务安全(transaction-safe(ACID compliant)型表。,安装MySql Database(10),安装MySql Database(11),安装MySql Database(12),安装MySql Database(13),安装MySql Database(14),安装MySql Database(15),sanming2011,安装MySql Database(16),安装MySql Database(17),安装MySql Database(18),安装MySql Database(19),安装MySql Database(20),安装MySql Database(21),安装MySql Database(22),安装MySql Database(23),安装MySql Database(24),安装MySql Database(25),create database test_db default character set gbk collate gbk_chinese_ci;create table test_table(id int(11)not null,姓名 char(10)not null)engine=myisam;insert into test_table values(1,刘持标);Select*from test_table;,安装MySql Database(26),配置Java-Mysql-JDBC(1),配置Java-Mysql-JDBC(2),配置Java-Mysql-JDBC(3),配置Java-Mysql-JDBC(4),配置Java-Mysql-JDBC(5),配置Apache Tomcat服务器(1),配置Apache Tomcat服务器(2),配置Apache Tomcat服务器(3),配置Apache Tomcat服务器(4),配置Apache Tomcat服务器(5),配置Apache Tomcat服务器(6),配置Apache Tomcat服务器(7),配置Apache Tomcat服务器(8),配置Apache Tomcat服务器(9),$CATALINA_HOMEbinstartup.bat$CATALINA_HOMEbinshutdown,配置Apache Tomcat服务器(10),配置Apache Tomcat服务器(11),配置Apache Tomcat服务器(12),配置Apache Tomcat服务器(13),配置Apache Tomcat服务器(14),安装NetBeans 开发平台(1),安装NetBeans 开发平台(2),安装NetBeans 开发平台(3),安装NetBeans 开发平台(4),安装NetBeans 开发平台(5),安装NetBeans 开发平台(6),安装NetBeans 开发平台(7),安装NetBeans 开发平台(8),安装NetBeans 开发平台(9),测试NetBeans 开发平台(1),测试NetBeans 开发平台(2),测试NetBeans 开发平台(3),测试NetBeans 开发平台(4),测试NetBeans 开发平台(5),测试NetBeans 开发平台(6),测试NetBeans 开发平台(7),测试NetBeans 开发平台(8),测试NetBeans 开发平台(9),测试NetBeans 开发平台(10),配置MySQL 数据库(1),配置MySQL 数据库(2),配置MySQL 数据库(3),E:applicationsNetBeans 6.9.1idemodulesextmysql-connector-java-5.1.6-bin.jar,配置MySQL 数据库(4),配置MySQL 数据库(5),配置MySQL 数据库(6),配置MySQL 数据库(7),配置MySQL 数据库(8),配置MySQL 数据库(9),create database javaeetests default character set gbk collate gbk_chinese_ci;use javaeetestscreate table lcb_studentRecord(StudentNumber INT NOT NULL PRIMARY KEY,Name char(60)not null,finalGrade double,timeStamp TIMESTAMP(8)engine=myisam;insert into lcb_studentRecord(StudentNumber,Name,finalGrade)values(1,刘持标,90);,配置MySQL 数据库(10),配置MySQL 数据库(11),配置MySQL 数据库(12),配置MySQL 数据库(13),配置MySQL 数据库(14),配置MySQL 数据库(15),MySql-J2EE(JSP-Servlet)Web 服务(1),MySql-J2EE(JSP-Servlet)Web 服务(2),MySql-J2EE(JSP-Servlet)Web 服务(3),JSP Page);out.println(学号姓名成绩记录时间);while(RS.next()out.println(+RS.getString(1)+RS.getString(2)+);out.println(RS.getDouble(3)+RS.getString(4)+);out.println();RS.close();catch(ClassNotFoundException e)out.println(Couldnt load database driver:+e.getMessage();catch(SQLException e)%,MySql-J2EE(JSP-Servlet)Web 服务(4),MySql-J2EE(JSP-Servlet)Web 服务(5),MySql-J2EE(JSP-Servlet)Web 服务(6),MySql-J2EE(JSP-Servlet)Web 服务(7),MySql-J2EE(JSP-Servlet)Web 服务(8),JSP Page 学生成绩登记表 姓名:学号:期末成绩:当前时间:,MySql-J2EE(JSP-Servlet)Web 服务(9),MySql-J2EE(JSP-Servlet)Web 服务(10),MySql-J2EE(JSP-Servlet)Web 服务(11),MySql-J2EE(JSP-Servlet)Web 服务(12),MySql-J2EE(JSP-Servlet)Web 服务(13),MySql-J2EE(JSP-Servlet)Web 服务(14),package server;import java.io.IOException;import java.io.PrintWriter;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 java.sql.*;import java.util.Properties;,插入,MySql-J2EE(JSP-Servlet)Web 服务(15),这些行将被下页替换,MySql-J2EE(JSP-Servlet)Web 服务(16),protected void processRequest(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException,ClassNotFoundException,SQLException response.setContentType(text/html;charset=UTF-8);PrintWriter out=response.getWriter();try String databaseURL=jdbc:mysql:/localhost:3306/javaeetests?useUnicode=true,MySql-J2EE(JSP-Servlet)Web 服务(17),Override protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException try processRequest(request,response);catch(ClassNotFoundException ex)Logger.getLogger(lcb_storeRecord.class.getName().log(Level.SEVERE,null,ex);catch(SQLException ex)Logger.getLogger(lcb_storeRecord.class.getName().log(Level.SEVERE,null,ex);Override protected void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException try processRequest(request,response);catch(ClassNotFoundException ex)Logger.getLogger(lcb_storeRecord.class.getName().log(Level.SEVERE,null,ex);catch(SQLException ex)Logger.getLogger(lcb_storeRecord.class.getName().log(Level.SEVERE,null,ex);,MySql-J2EE(JSP-Servlet)Web 服务(18),MySql-J2EE(JSP-Servlet)Web 服务(19),MySql-J2EE(JSP-Servlet)Web 服务(20),MySql-J2EE(JSP-Servlet)Web 服务(21),JSP Page function trim(s)return s.replace(/s*/,).replace(/s*$/,);function validate()if(trim(document.frmLogin.sUserName.value)=)alert(Login empty);document.frmLogin.sUserName.focus();return false;else if(trim(document.frmLogin.sPwd.value)=)alert(password empty);document.frmLogin.sPwd.focus();return false;User Name Password,CREATE TABLE usermaster(sUserID varchar(45)NOT NULL,sEmail varchar(250)NOT NULL,sFirstName varchar(45)NOT NULL,sLastName varchar(45)NOT NULL,iDOB datetime NOT NULL,cGender varchar(45)NOT NULL,iCountryID int(10)unsigned NOT NULL,iCityID varchar(45)NOT NULL,iUserType varchar(45)DEFAULT NULL,iUserLevel varchar(45)DEFAULT NULL,sPassword varchar(45)NOT NULL,sForgetPassword varchar(45)DEFAULT NULL,sContact bigint(20)unsigned NOT NULL,sCreatedBy varchar(45)DEFAULT NULL,dCreatedDate datetime DEFAULT NULL,sModifiedBy varchar(45)DEFAULT NULL,sModifiedDate datetime DEFAULT NULL,sStatus varchar(45)NOT NULL,PRIMARY KEY(sUserID),UNIQUE KEY sEmail(sEmail)engine=myisam;insert into usermaster(sUserID,sEmail,sFirstName,sLastName,iDOB,cGender,iCountryID,iCityID,sPassword,sContact,sStatus)values(lcb,持标,刘,1969-12-31 23:59:59,male,86,Sanming,sanming2011,18759887980,A);,MySql-J2EE(JSP-Servlet)Web 服务(22),MySql-J2EE(JSP-Servlet)Web 服务(23),MySql-J2EE(JSP-Servlet)Web 服务(24),MySql-J2EE(JSP-Servlet)Web 服务(25),MySql-J2EE(JSP-Servlet)Web 服务(26),MySql-J2EE(JSP-Servlet)Web 服务(27),MySql-J2EE(JSP-Servlet)Web 服务(28),MySql-J2EE(JSP-Servlet)Web 服务(29),欢迎);%输入成绩显示成绩,MySql-J2EE(JSP-Servlet)Web 服务(30),MySql-J2EE(JSP-Servlet)Web 服务(31),MySql-J2EE(JSP-Servlet)Web 服务(32),MySql-J2EE(JSP-Servlet)Web 服务(33),MySql-J2EE(JSP-Servlet)Web 服务(34),MySql-J2EE(JSP-Servlet)Web 服务(35),MySql-J2EE(JSP-Servlet)Web 服务(36),J2EE Web 服务在不同服务器部署(1),J2EE Web 服务在不同服务器部署(2),