PERTEMUAN 3.

Slides:



Advertisements
Similar presentations
Apache Tomcat as a container for Servlets and JSP
Advertisements

Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password: In Netbeans you can graphically create.
Servlets and JDBC. Servlets A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password:
Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Servlets Stoney Jackson
Object Oriented Programming Java Java’s JDBC Allows access to any ANSI SQL-2 DBMS Does its work in terms of SQL The JDBC has classes that represent:
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password: In Netbeans you can graphically create.
2/16/2004 Dynamic Content February 16, /16/2004 Assignments Due – Message of the Day Part 1 Due – Reading and Warmup Work on Message of the Day.
Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password:
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
1 Databases & Web-based Applications JDBC & Java Servlets A. Benabdelkader ©UvA, 2002/2003.
Examples of Using Servlets and JSP Representation and Management of Data on the Internet.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Java Servlets and Java Server Pages Carol Wolf Computer Science.
DataBases and SQL INFSY 547 Spring Course Wrap Up April 12: Complete Work on Servlets Review of Team Projects Close of Portfolio Work April 19:
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Servlet Lifecycle Lec 28. Servlet Life Cycle  Initialize  Service  Destroy Time.
MDCFUG Is Java in Your Future? Tyler Williams Principal dataTerrace
Servlets Database Access. Agenda:  Setup Java Environment  Install Database  Install Database Drivers  Create Table and add records  Accessing a.
Java Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface Servlet and the Servlet Life Cycle HttpServlet Class.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Why server side programming ?. What is java servlet ?
JDBC – Java DataBase Connectivity. JDBC API Overview JDBC is Java API that allows the Java programmers to access database management system from Java.
JSP Presented by K.Venkata Ratnam HOD MCA (Dept) Newton’s Institute of Engineering.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
S ERVLETS Hits Counter 21-Nov-15. S ERVLETS - H ITS C OUNTER Many times you would be interested in knowing total number of hits on a particular page of.
 2002 Prentice Hall. All rights reserved. 9.8 Multi-Tier Applications: Using JDBC from a Servlet Three-tier distributed applications –User interface –Business.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
Mark Dixon 1 11 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
Configuration Web Server Tomcat - Install JDK Install Tom cat Configure Tom cat for running Servlet C:\Program Files\Apache Software Foundation\Tomcat.
Java and the Web CSE 3330 Southern Methodist University.
Introduction To HTML Dr. Magdi AMER. HTML elements.
ClaRA web services V. Gyurjyan Clas12 Software Meeting
How CGI and Java Servlets are Run By David Stein 14 November 2006.
Umair Javed©2005 Enterprise Application Development Java Database Connectivity (JDBC) JDBC1.
April 20023CSG11 Electronic Commerce Java (2) John Wordsworth Department of Computer Science The University of Reading Room 129,
J2EE/Java EE Apache Tomcat v9 IBM Websphere v8 Redhat JBoss EAP v6 Oracle Weblogic v12 Fusion Web Tier ServletsJSPJSF Business Tier JMXJMSEJB.
Java Database Connectivity JDBC. Open Database Connectivity developed by Microsoft to provide interaction with databases using SQL. Use the JDBC-ODBC.
Introduction to Servlets
J2EE (Enterprise Programing)
PERTEMUAN 7.
PERTEMUAN 2.
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Net-centric Computing
PERTEMUAN 5.
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Servlets Hits Counter 20-Jul-18.
Session Tracking in Servlets
HTTP Servlet Overview Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might.
V. Gyurjyan Clas12 Software Meeting
SERVLETS AND JDBC.
In Class Assg 4 - Solution
In Class Assg 3 - Solution
Jagdish Gangolly State University of New York at Albany
Servlets and JSP 20-Nov-18 servletsJSP.ppt.
COP 4610L: Applications in the Enterprise Spring 2005
Servlets.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Java Servlets Servlet Overview Servlets and HTML Forms Servlet Basics
Introduction to Java Servlets
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Basic servlet structure
COSC 2206 Internet Tools Java Servlets with JDBC and MySQL
Presentation transcript:

PERTEMUAN 3

Menampilkan Isi Database Coding java Convert ke class Deploy tools Cek di Browser

Mengisi Database Isi tbMahasiswa dengan data sebagai berikut : NIM Nama Alamat 101001 John Jakarta 101002 Peter Sukabumi 101003 Clara Cirebon 101004 Veronica Jogja 101005 Michael Bandung

Coding (1) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class lihatdatabase extends HttpServlet{ static int i; Connection con; PrintWriter out; ResultSet rs; public void init(){ i = 0; con=null; out=null; rs=null; } //close void init()

Coding (2) public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ i++; out=response.getWriter(); out.println("<B>You are user no. " + i +" to visit this site.</B><BR><BR>"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:mahasiswa","root",""); PreparedStatement pstmt=null; String query=null; query= "select * from tb_mahasiswa"; pstmt=con.prepareStatement(query); rs=pstmt.executeQuery(); out.println("<B><center>Data Mahasiswa</center></B>"); ResultSetMetaData rsmd= rs.getMetaData(); int colcount=rsmd.getColumnCount();

Coding (3) out.println("<TABLE ALIGN = CENTER BORDER=1 CELLPADDING=2>"); out.println("<TR>"); out.println("<TH>NIM</TH>"); out.println("<TH>Nama</TH>"); out.println("<TH>Alamat</TH>"); out.println("</TR>"); while(rs.next()){ out.println("<TD>" + rs.getString("nim") + "</TD>"); out.println("<TD>" + rs.getString("nama") + "</TD>"); out.println("<TD>" + rs.getString("alamat") + "</TD>"); } // close while out.println("</TABLE>"); out.println("</BODY>"); } // close try

Coding (4) catch(Exception e){ out.println(e.toString()); } // close catch } // close void doGet public void destroy(){ try{ i = 0; con.close(); out.close(); rs.close(); } // close try catch (SQLException se){ out.println(se.toString()); } //close void destroy() } //close class

Simpan coding di lihatdatabasemi.java Ubah file java ke file class Deploytools Context Root : praktikumtigami Aliases : lihatdatabasemi

Cek di Browser