MDCFUG Is Java in Your Future? Tyler Williams Principal dataTerrace

Slides:



Advertisements
Similar presentations
Exercises of the Tutorial on Advanced Web Programming Authors: Miroslava Mitrovic Dragan Milicev Nino.
Advertisements

Apache Tomcat as a container for Servlets and JSP
Java Server Pages (JSP)
Java Servlets Java Server Pages (JSP)
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Introduction to Servlets Based on: Hall, Brown, Core Servlets and JavaServer Pages.
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
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.
An introduction to Java Servlet Programming
June 1, 2000 Object Oriented Programming in Java (95-707) Advanced Topics 1 Lecture 10 Object Oriented Programming in Java Advanced Topics Servlets.
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.
Java Server Faces Model/View/Controller Design Pattern for Web Development Slides adapted from “Core JavaServer Faces” by Geary and Horstmann and the J2EE.
Web Development in Java Andrew Simpson. Overview Background Language Details Java Server Pages (JSP) Servlets Database Connectivity (JDBC) Samples and.
Introduction to Servlet & JSP
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Java Servlets and JSP.
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.
Introduction Servlets and JSP Celsina Bignoli
Development Platforms Computer Networks Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
Examples of Using Servlets and JSP Representation and Management of Data on the Internet.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
Java Servlets and Java Server Pages Carol Wolf Computer Science.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
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:
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
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.
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.
Mark Dixon 1 09 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
Java Servlets & Java Server Pages Lecture July 2013.
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
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.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
@2008 Huynh Ngoc Tin Chapter #2 JAVA SERVLET PRGRAMMING.
JavaServer Page by Antonio Ko. Overview ► Introduction ► What is a servlet? ► What can servlets do? ► Servlets Vs JSP ► Syntax ► Samples ► JavaBean ►
Java Servlets and Java Server Pages Norman White Stern School of Business.
JSP Pages. What and Why of JSP? JSP = Java code imbedded in HTML or XML –Static portion of the page is HTML –Dynamic portion is Java Easy way to develop.
 2002 Prentice Hall. All rights reserved. 9.8 Multi-Tier Applications: Using JDBC from a Servlet Three-tier distributed applications –User interface –Business.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
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.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
Java Servlets Java Server Pages (JSP)
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
Introduction To HTML Dr. Magdi AMER. HTML elements.
Web Programming Assistant Professor Xiaozhong Liu
Umair Javed©2005 Enterprise Application Development Java Database Connectivity (JDBC) JDBC1.
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
Java Database Connectivity JDBC. Open Database Connectivity developed by Microsoft to provide interaction with databases using SQL. Use the JDBC-ODBC.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction to Servlets
JDBC & Servlet CSE 4504/6504 Lab.
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Making Text for the Web part 6
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
Servlets Servlets are modules that extend the functionality of a “java-enabled” web-server They normally generate HTML code and web content dynamically.
Presentation transcript:

MDCFUG Is Java in Your Future? Tyler Williams Principal dataTerrace

Agenda The Java Learning Curve Why This is a Good Thing J2EE Breakdown Sample Program Q & A

My Background Consultant 2 1/2 years Certified CF Developer 4 years CF 1 year Java 6 years Oracle

Java Language Barriers Non-Tag Based Lower Level Than CF (more code) Object Oriented Strongly Typed & Case Sensitive Large “Function Library” Powerful, Complex and Less Forgiving

Power of Perception CF is Easy to Learn Ease of Entry Brings Less Qualified Programmers to the Language More Low Grade Programs are Written CF Language Gets a Bad Rap

The Good Side of Barriers Less Competition Higher Rates Protected Reputation

J2EE - Enterprise Java Server-side Web Development Standard Created by Sun Many Competing Application Servers App Servers Must Pass a Compatibility Test Suite Vendors Add Extensions & JSP Tag Libraries

J2EE Technologies Lower Complexity –Java Server Pages (JSP) –Servlets Higher Complexity –JDBC (Database Connectivity) –Enterprise Java Beans (EJB) –Java Messaging Service (JMS)

JSP Example <% String str = "8th"; %> Simple JSP Page Welcome to the dimension

Servlet Example import java.io.*; import servlet.*; import servlet.http.*; public class SimpleServlet extends HttpServlet { public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { response.setContentType(“text/html”); PrintWriter out = response.getWriter(); out.println(“ Simple Servlet Example ”); out.println(“ ”); String str = "8th"; out.println(“ Welcome to the ” + str + “ dimension ”); out.println(“ ”); }

JDBC Example Class.forName("oracle.jdbc.driver.OracleDriver"); String stUrl_= Connection connection_ = DriverManager.getConnection(stUrl_, ”username",”password"); PreparedStatement statement_ = connection_.prepareStatement("SELECT fname, lname FROM EMPLOYEE"); ResultSet rs = statement_.executeQuery(); //execute query while (rs.next()) { String firstName = rs.getString(1); String lastName = rs.getString(2); strOut = strOut + firstName + " " + lastName + " "; } rs.close(); statement_.close(); connection_.close();

CF Comparison SELECT fname, lname FROM EMPLOYEE #main_select.fname# #main_select.lname#

JDBC Metadata getColumnCount - Returns the number of columns in this Result Set getColumnName - Get the designated column's name getColumnType - Retrieve the designated column's SQL type isAutoIncrement - Indicates whether the designated column is automatically numbered, thus read-only

Model-View-Controller (MVC) Model = Data = JDBC View = Presentation = JSP Controller = Framework = Servlet

MVC Flow 1) Client submits a page request 2) Servlet interprets request 3) Servlet retrieves necessary info from JDBC 4) Servlet hands off request and details to JSP for formatting and presentation Client Servlet JSP JDBC

Complete MVC Example DimensionApp.java (Servlet) DimensionVO.java (JDCB Class) Display.jsp (JSP)

DimensionApp.java import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import DimensionVO; public class DimensionApp extends HttpServlet { public void service (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { DimensionVO dvo = new DimensionVO(); String mydim = dvo.getDimension(); req.setAttribute("dimension", mydim); RequestDispatcher rd; rd = getServletContext().getRequestDispatcher("/jsp/Display.jsp"); rd.forward(req, res); }

DimensionVO.java import java.sql.*; import java.util.*; import java.io.*; public class DimensionVO { String strOut; String stUrl_= "jdbc:odbc:mdcfug"; private Connection connection_ = null; private PreparedStatement statement_ = null; private ResultSet rs; public String getDimension () throws IOException { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connection_ = DriverManager.getConnection(stUrl_, "Admin",""); statement_ = connection_.prepareStatement("SELECT dimension FROM DIMENSIONS"); rs = statement_.executeQuery(); //execute query String mydim = rs.getString(1); strOut = mydim; rs.close(); statement_.close(); connection_.close(); } catch (ClassNotFoundException e) {// Shouldn't happen - it comes with the JRE} catch (SQLException e) {System.err.println("Unable to connect to the DB " + e);} return strOut; }

Display.jsp MVC Example Welcome to the dimension

Java Resources Java’s Sun – Java Portals – – Sun’s JDBC Tutorial – /onlineTraining/Database/JDBC20Intro/

Java Bookshelf The Java Language –Java in a Nutshell - Flanagan Servlets/JSP –Java Servlet Programming - Hunter –Web Development With JavaServer Pages - Fields/Kolb –Core Servlets and JavaServer Pages - Hall J2EE Application Architecture –Core J2EE Patterns - Alur