Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tomcat, JSP, Servlet Tutorial. Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application.

Similar presentations


Presentation on theme: "Tomcat, JSP, Servlet Tutorial. Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application."— Presentation transcript:

1 Tomcat, JSP, Servlet Tutorial

2 Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application

3 Installing the Java Software Development Kit JDK 5.0 Update 4 (SDK/JDK) Choose SDK not JRE JSP requires a compiler in SDK http://java.sun.com/j2se/1.5.0/downloa d.jsp http://java.sun.com/j2se/1.5.0/downloa d.jsp

4 Set JAVA_HOME environment variable Set JAVA_HOME to the location of Java SDK (C:\Program Files\Java\jdk1.5.0_04)

5 Install Tomcat 5.5 5.5.9 Binary 5.5.9 exe http://jakarta.apache.org/site/download s/downloads_tomcat-5.cgi http://jakarta.apache.org/site/download s/downloads_tomcat-5.cgi

6 Set CATALINA_HOME environment variable Set CATALINA_HOME to the location of Tomcat (C:\Program Files\Apache Software Foundation\Tomcat 5.5)

7 Example Web Application Overview Start Tomcat by bin/tomcat5w

8 Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application

9 Download the source code of servlet HelloWorldExample.java http://140.116.82.24/HelloWorldExampl e.java

10

11 Deploy a servlet – Step 1 Write the servlet Java code Copy Tomcat 5.5\common\lib\servlet- api.jar to jre1.5.0_04\lib\ext Compile javac HelloWorldExample.java Copy HelloWorldExample.class to Tomcat 5.5\webapps\ROOT\WEB- INF\classes

12 Deploy a servlet – Step 2 Add servlet mapping to Tomcat 5.5\webapps\ROOT\WEB-INF\web.xml

13 HelloWorldExample servlet http://140.116.82.24/example_servlet/ HelloWorldExample http://140.116.82.24/example_servlet/ HelloWorldExample

14 Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application

15 Write JSP code Write JSP pages then deploy them as html files contains Java code Copy JSP code from http://140.116.82.24/jsp_code.htm

16

17 Deploy JSP Save JSP as HelloWorld.jsp to Tomcat 5.5\webapps\ROOT See the result at http://140.116.82.24/HelloWorld.jsp

18 Result of a JSP page The same result as the servlet replies Much easier

19 Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application

20 Install MySQL 4.1 Windows (x86) 4.1.13a http://dev.mysql.com/downloads/mysql /4.1.html http://dev.mysql.com/downloads/mysql /4.1.html

21 Configure root password \bin\mysql – u root USE mysql UPDATE user SET password=password('root3394') where user='root'; FLUSH PRIVILEGES; quit

22 Install EMS MySQL Manager 3 http://www.sqlmanager.net/

23 Create a database table

24 Handset table Create a handset table with fields manufacturer model_name price

25 Data in the handset table EMS lets you to input data easily

26 Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application

27 Use MySQL on Tomcat by MySQL JDBC Driver Source and Binaries (zip) http://dev.mysql.com/downloads/conne ctor/j/3.1.html http://dev.mysql.com/downloads/conne ctor/j/3.1.html Input mysql-connector-java-3.1.10- bin.jar to ROOT\WEB-INF\lib

28

29

30 Result of HandsetList.jsp http://140.116.82.24/HandsetList.jsp

31 Reference JavaServer Pages By Hans Bergsten


Download ppt "Tomcat, JSP, Servlet Tutorial. Outline Setting Up the JSP Environment Servlet JSP Setting Up the MySQL Environment e-commerce web application."

Similar presentations


Ads by Google