Download presentation
Presentation is loading. Please wait.
1
Example Student Record Application
2
Environment Run environment: JDK 1.4 Run environment: JDK 1.4 Web server: TOMCAT as JSP container Web server: TOMCAT as JSP container Application Server: pure Java Class Application Server: pure Java Class Database: Oracle + JDBC driver Database: Oracle + JDBC driver Development tool Development tool NetBeans IDE 3.5.1 NetBeans IDE 3.5.1 ANT+Notepad ANT+Notepad
3
Tomcat Tomcat is a Servlet/JSP container Tomcat is a Servlet/JSP container Tomcat implements the Servlet and JavaServer Pages specifications from Java Software Tomcat implements the Servlet and JavaServer Pages specifications from Java Software
4
Architecture of Student Record application
5
Development work flow
6
Logic analysis Under the support of Rational XDE
7
Logic design Server Side: Servlet + pure java class Server Side: Servlet + pure java class Client Side: JSP Client Side: JSP
8
Logical Architecture of Server Side Under the support of Rational XDE Design on J2EE framework
9
ContextListener <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN“ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN“ "http://java.sun.com/dtd/web-app_2_3.dtd"> "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app> Oracle Test App Oracle Test App StudentPackage.contextlisenter StudentPackage.contextlisenter </web-app>Web.xml
10
JSP Logical Architecture of Client Side
11
JSP
12
Student Record Application Run Cycle Install or Start StudentRecord Application Call up JSP Stop StudentRecord application
13
Install or Start StudentRecord Application
14
Contextlistener start an Application public void contextInitialized(ServletContextEvent sce) { ServletContext sc= sce.getServletContext(); ServletContext sc= sce.getServletContext(); try try { StudentPackage.StudentDB studentdb= new StudentPackage.StudentDB(); StudentPackage.StudentDB studentdb= new StudentPackage.StudentDB(); sc.setAttribute ("studentdb", studentdb); sc.setAttribute ("studentdb", studentdb); } catch (Exception e) catch (Exception e) { sc.log ("Couldn't create database attribute: " + e.getMessage ()); sc.log ("Couldn't create database attribute: " + e.getMessage ()); } }// end of public void contextInitialized(ServletContextEvent e) }// end of public void contextInitialized(ServletContextEvent e)
15
Call up Home.jsp
16
Use StudentDB instance <% StudentPackage.StudentDB studentdb= (StudentPackage.StudentDB) application.getAttribute("studentdb"); StudentPackage.StudentDB studentdb= (StudentPackage.StudentDB) application.getAttribute("studentdb"); Collection students = studentdb.getStudents(); Collection students = studentdb.getStudents();%>Home.jsp
17
Stop Student Record Application
18
Contextlistener stop an Application public void contextDestroyed(ServletContextEvent sce) { ServletContext sc = sce.getServletContext (); ServletContext sc = sce.getServletContext (); StudentPackage.StudentDB studentdb = (StudentPackage.StudentDB) sc.getAttribute("studentdb"); StudentPackage.StudentDB studentdb = (StudentPackage.StudentDB) sc.getAttribute("studentdb"); studentdb.close(); studentdb.close(); sc.removeAttribute ("studentdb"); sc.removeAttribute ("studentdb"); }
19
Prepare Database Create table Create table CREATE TABLE STUDENTDB ( ID NUMBER(10) NOT NULL PRIMARY KEY, FIRSTNAME VARCHAR2(30) NOT NULL, FIRSTNAME VARCHAR2(30) NOT NULL, SURNAME VARCHAR2(30) NOT NULL SURNAME VARCHAR2(30) NOT NULL); Insert student record Insert student record insert into studentdb (id, firstname, surname) values (101,'Emma','Dean');
20
Configure Application StudentRecord's Development Directory under NetBeans
21
Configure Application (Cont.) build.properties build.properties
22
Configure Application (Cont.) Build.xml Build.xml Server.xml Server.xml Web.xml Web.xml
23
Configure Application (Cont.) /src/*.java /src/*.java
24
Configure Application (Cont.) /web/*.jsp /web/*.jsp
25
Building, Installing, Deploying Use ANT to build, install and deploy Student Record Application Use ANT to build, install and deploy Student Record Application Use Neatbeans IDE to build Student Record Application Use Neatbeans IDE to build Student Record Application
26
Run Application
27
End Thank you.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.