1 / 27

Example

Example. Student Record Application. Environment. Run environment: JDK 1.4 Web server: TOMCAT as JSP container Application Server: pure Java Class Database: Oracle + JDBC driver Development tool NetBeans IDE 3.5.1 ANT+Notepad. Tomcat. Tomcat is a Servlet/JSP container

lester-luna
Download Presentation

Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Example Student Record Application

  2. Environment • Run environment: JDK 1.4 • Web server: TOMCAT as JSP container • Application Server: pure Java Class • Database: Oracle + JDBC driver • Development tool NetBeans IDE 3.5.1 ANT+Notepad

  3. Tomcat • Tomcat is a Servlet/JSP container • 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 • Client Side: JSP

  8. Logical Architecture of Server Side Design on J2EE framework Under the support of Rational XDE

  9. ContextListener <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN“ "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <description>Oracle Test App</description> <listener> <listener-class>StudentPackage.contextlisenter</listener-class> </listener> </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(); try { StudentPackage.StudentDB studentdb= new StudentPackage.StudentDB(); sc.setAttribute ("studentdb", studentdb); } catch (Exception e) { sc.log ("Couldn't create database attribute: " + e.getMessage ()); } }// end of public void contextInitialized(ServletContextEvent e)

  15. Call up Home.jsp

  16. Use StudentDB instance <% StudentPackage.StudentDB studentdb= (StudentPackage.StudentDB) application.getAttribute("studentdb"); 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 (); StudentPackage.StudentDB studentdb = (StudentPackage.StudentDB) sc.getAttribute("studentdb"); studentdb.close(); sc.removeAttribute ("studentdb"); }

  19. Prepare Database • Create table CREATE TABLE STUDENTDB ( ID NUMBER(10) NOT NULL PRIMARY KEY, FIRSTNAME VARCHAR2(30) NOT NULL, SURNAME VARCHAR2(30) NOT NULL ); • 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

  22. Configure Application (Cont.) • Build.xml • Server.xml • Web.xml

  23. Configure Application (Cont.) • /src/*.java

  24. Configure Application (Cont.) • /web/*.jsp

  25. Building, Installing, Deploying • Use ANT to build, install and deploy Student Record Application • Use Neatbeans IDE to build Student Record Application

  26. Run Application

  27. EndThank you.

More Related