SlideShare une entreprise Scribd logo
1  sur  43
Tutorial:  Server-Side Web Applications with Java, JSP and Tomcat Eran Toch December 2004 Methodologies in Information Systems Development
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Web Application vs. Web Site Web Site Web Application
The Difference – cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Web Application Architecture JSP Application Server Browser Servlet Java Classes / EJB HTTP / HTML DB / ERP /  Legacy
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tomcat Installation ,[object Object],[object Object],[object Object],[object Object]
Tomcat and Java 5 ,[object Object],[object Object]
Tomcat Installation – cont’d If you want Tomcat to startup every time the computer is rebooted, check the “service” option. If you wish to use Tomcat for only for development, it’s best to leave the service option unchecked.
Tomcat Installation - Port You can configure the port that Tomcat will be using. If you want it to be available publicly (behind firewalls etc), change the default port to 80. Otherwise, leave it as it is (880). You can always change it later, in the [TOMCAT_HOME]/conf/server.xml configuration file.
Running Tomcat ,[object Object],[object Object],[object Object]
Managing Tomcat ,[object Object],[object Object],[object Object]
Managing Tomcat Console Web Application management  Number of current sessions Start, stop, restart and un-deploy applications
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Building A Web Application ,[object Object],Tomcat-home conf common webapps ... phones WEB-INF lib classes jsp This is the hard way… There are better
Creating JSP Project in Eclipse ,[object Object],[object Object]
Creating JSP Project – cont’d ,[object Object],[object Object]
Creating Java Classes Project ,[object Object],[object Object]
Creating Java Project – cont’d ,[object Object]
Creating Java Project – cont’d ,[object Object],[object Object]
Better ways ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Our “Phones” Application ,[object Object],[object Object],select_entry.jsp display_phone.jsp PhoneEntry.java DBConnector.java Database
PhoneEntry.java package edu.technion.methodologies.phones ;   public class PhoneEntry  { private int id = 0 ; private String name ; private  String phone ; private  String email ; public void load(int id ) { DBConnector.loadPhone(id, this ); } public void save () { if (id == 0 ) { id = DBConnector.insertPhone(this ); } else { DBConnector.updatePhone(id, this ); } } //getters and setters… }
DBConnector.java ,[object Object]
Writing Scriplets in JSP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JSP Scripting Elements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JSP Directives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
select_entry.jsp ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],HTML Header HTML form Nested HTML table structure HTML text input
select_entry.jsp – the HTML output
display_phone.jsp <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;> <%@ page   import = &quot;edu.technion.methodologies.phones.*&quot;  %> <HTML> <HEAD> <TITLE> Phone Entry </TITLE> </HEAD> <BODY> <% String idParam = request.getParameter( &quot;id&quot; ); int  id = 0; if  (idParam !=  null ){ id = Integer.parseInt(idParam); } PhoneEntry phoneEntry =  new  PhoneEntry(); phoneEntry.load(id); %> Handling the request Creating the JavaBean Importing libraries
display_phone.jsp – cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
display_phone.jsp – the HTML Output
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JSP Include ,[object Object],<table  border = &quot;0&quot;   width = &quot;100%&quot;   cellpadding = &quot;4&quot; > <tr  bgcolor = &quot;99CCFF&quot; > <td><a  href = &quot;select_entry.jsp&quot; > home </a></td> </tr> </table> Included JSP file
JSP Include – cont’d … <BODY> <%@ include   file = &quot;header.jsp&quot; %> <% … We add the include declarative into display_phone.jsp  And we get:
Session and Application Objects ,[object Object],[object Object],[object Object],[object Object],//Setting an object within the session session.setAttribute( &quot;last_searched_id&quot; ,  new  Integer(id)); //Getting an object from the session Integer lastID = (Integer)session.getAttribute( &quot;last_searched_id&quot; ); out.println(lastID);
Advanced Issues ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model 2 Architecture ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model 2 Architecture – cont’d .jsp .jsp Form request forward Database classes servlet VIEW CONTROLLER MODEL
Struts ,[object Object],[object Object],[object Object]
References ,[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
BG Java EE Course
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
Sunil Pandey
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
Rich Helton
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
Rich Helton
 

Tendances (20)

JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Jsp
JspJsp
Jsp
 
Spring aop
Spring aopSpring aop
Spring aop
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial Basics
 
Rest web service
Rest web serviceRest web service
Rest web service
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
ASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation Controls
 
Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8
 
Applet
AppletApplet
Applet
 
Best Laravel Eloquent Tips and Tricks
Best Laravel Eloquent Tips and TricksBest Laravel Eloquent Tips and Tricks
Best Laravel Eloquent Tips and Tricks
 

En vedette

Microsoft Sharepoint and Java Application Development
Microsoft Sharepoint and Java Application DevelopmentMicrosoft Sharepoint and Java Application Development
Microsoft Sharepoint and Java Application Development
David Nuescheler
 
Presentation Norman Dl Consulting (Eng)
Presentation Norman Dl Consulting (Eng)Presentation Norman Dl Consulting (Eng)
Presentation Norman Dl Consulting (Eng)
Igor_Gorelnikov
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Quek Lilian
 
Test De Rapidez Mental
Test De Rapidez MentalTest De Rapidez Mental
Test De Rapidez Mental
guest6d857a2
 
Mitigation strategies for the protection of health care workers and first res...
Mitigation strategies for the protection of health care workers and first res...Mitigation strategies for the protection of health care workers and first res...
Mitigation strategies for the protection of health care workers and first res...
Omar Ha-Redeye
 

En vedette (20)

resume
resumeresume
resume
 
Open
OpenOpen
Open
 
Navidad Noel 2009 Show
Navidad Noel 2009 ShowNavidad Noel 2009 Show
Navidad Noel 2009 Show
 
Crooked Creek History
Crooked Creek HistoryCrooked Creek History
Crooked Creek History
 
Microsoft Sharepoint and Java Application Development
Microsoft Sharepoint and Java Application DevelopmentMicrosoft Sharepoint and Java Application Development
Microsoft Sharepoint and Java Application Development
 
Lecture2
Lecture2Lecture2
Lecture2
 
Presentation Norman Dl Consulting (Eng)
Presentation Norman Dl Consulting (Eng)Presentation Norman Dl Consulting (Eng)
Presentation Norman Dl Consulting (Eng)
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
 
Scalable Java Application Development on AWS
Scalable Java Application Development on AWSScalable Java Application Development on AWS
Scalable Java Application Development on AWS
 
Quantum Networks[1] Power Point
Quantum Networks[1] Power PointQuantum Networks[1] Power Point
Quantum Networks[1] Power Point
 
Test De Rapidez Mental
Test De Rapidez MentalTest De Rapidez Mental
Test De Rapidez Mental
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
 
Java, app servers and oracle application grid
Java, app servers and oracle application gridJava, app servers and oracle application grid
Java, app servers and oracle application grid
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Anjo
AnjoAnjo
Anjo
 
Jyoti Vol.IX Bulletin of Rotary Club of Kalyan
Jyoti Vol.IX Bulletin of Rotary Club of KalyanJyoti Vol.IX Bulletin of Rotary Club of Kalyan
Jyoti Vol.IX Bulletin of Rotary Club of Kalyan
 
Mitigation strategies for the protection of health care workers and first res...
Mitigation strategies for the protection of health care workers and first res...Mitigation strategies for the protection of health care workers and first res...
Mitigation strategies for the protection of health care workers and first res...
 
Soluciones 130220212358-phpapp01
Soluciones 130220212358-phpapp01Soluciones 130220212358-phpapp01
Soluciones 130220212358-phpapp01
 
Tibet
TibetTibet
Tibet
 
Keen Sales Slide Share
Keen Sales Slide ShareKeen Sales Slide Share
Keen Sales Slide Share
 

Similaire à Ta Javaserverside Eran Toch

J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
Svetlin Nakov
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 

Similaire à Ta Javaserverside Eran Toch (20)

Ibm
IbmIbm
Ibm
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
Jsp tutorial
Jsp tutorialJsp tutorial
Jsp tutorial
 
PPT
PPTPPT
PPT
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVC
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
Wicket Introduction
Wicket IntroductionWicket Introduction
Wicket Introduction
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 
JSR 168 Portal - Overview
JSR 168 Portal - OverviewJSR 168 Portal - Overview
JSR 168 Portal - Overview
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 

Plus de Adil Jafri

Csajsp Chapter5
Csajsp Chapter5Csajsp Chapter5
Csajsp Chapter5
Adil Jafri
 
Programming Asp Net Bible
Programming Asp Net BibleProgramming Asp Net Bible
Programming Asp Net Bible
Adil Jafri
 
Network Programming Clients
Network Programming ClientsNetwork Programming Clients
Network Programming Clients
Adil Jafri
 
Csajsp Chapter10
Csajsp Chapter10Csajsp Chapter10
Csajsp Chapter10
Adil Jafri
 
Flashmx Tutorials
Flashmx TutorialsFlashmx Tutorials
Flashmx Tutorials
Adil Jafri
 
Java For The Web With Servlets%2cjsp%2cand Ejb
Java For The Web With Servlets%2cjsp%2cand EjbJava For The Web With Servlets%2cjsp%2cand Ejb
Java For The Web With Servlets%2cjsp%2cand Ejb
Adil Jafri
 
Csajsp Chapter12
Csajsp Chapter12Csajsp Chapter12
Csajsp Chapter12
Adil Jafri
 
Flash Tutorial
Flash TutorialFlash Tutorial
Flash Tutorial
Adil Jafri
 

Plus de Adil Jafri (20)

Csajsp Chapter5
Csajsp Chapter5Csajsp Chapter5
Csajsp Chapter5
 
Php How To
Php How ToPhp How To
Php How To
 
Php How To
Php How ToPhp How To
Php How To
 
Owl Clock
Owl ClockOwl Clock
Owl Clock
 
Phpcodebook
PhpcodebookPhpcodebook
Phpcodebook
 
Phpcodebook
PhpcodebookPhpcodebook
Phpcodebook
 
Programming Asp Net Bible
Programming Asp Net BibleProgramming Asp Net Bible
Programming Asp Net Bible
 
Tcpip Intro
Tcpip IntroTcpip Intro
Tcpip Intro
 
Network Programming Clients
Network Programming ClientsNetwork Programming Clients
Network Programming Clients
 
Jsp Tutorial
Jsp TutorialJsp Tutorial
Jsp Tutorial
 
Csajsp Chapter10
Csajsp Chapter10Csajsp Chapter10
Csajsp Chapter10
 
Javascript
JavascriptJavascript
Javascript
 
Flashmx Tutorials
Flashmx TutorialsFlashmx Tutorials
Flashmx Tutorials
 
Java For The Web With Servlets%2cjsp%2cand Ejb
Java For The Web With Servlets%2cjsp%2cand EjbJava For The Web With Servlets%2cjsp%2cand Ejb
Java For The Web With Servlets%2cjsp%2cand Ejb
 
Html Css
Html CssHtml Css
Html Css
 
Digwc
DigwcDigwc
Digwc
 
Csajsp Chapter12
Csajsp Chapter12Csajsp Chapter12
Csajsp Chapter12
 
Html Frames
Html FramesHtml Frames
Html Frames
 
Flash Tutorial
Flash TutorialFlash Tutorial
Flash Tutorial
 
C Programming
C ProgrammingC Programming
C Programming
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Ta Javaserverside Eran Toch

  • 1. Tutorial: Server-Side Web Applications with Java, JSP and Tomcat Eran Toch December 2004 Methodologies in Information Systems Development
  • 2.
  • 3. Web Application vs. Web Site Web Site Web Application
  • 4.
  • 5. Java Web Application Architecture JSP Application Server Browser Servlet Java Classes / EJB HTTP / HTML DB / ERP / Legacy
  • 6.
  • 7.
  • 8.
  • 9. Tomcat Installation – cont’d If you want Tomcat to startup every time the computer is rebooted, check the “service” option. If you wish to use Tomcat for only for development, it’s best to leave the service option unchecked.
  • 10. Tomcat Installation - Port You can configure the port that Tomcat will be using. If you want it to be available publicly (behind firewalls etc), change the default port to 80. Otherwise, leave it as it is (880). You can always change it later, in the [TOMCAT_HOME]/conf/server.xml configuration file.
  • 11.
  • 12.
  • 13. Managing Tomcat Console Web Application management Number of current sessions Start, stop, restart and un-deploy applications
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. PhoneEntry.java package edu.technion.methodologies.phones ;   public class PhoneEntry { private int id = 0 ; private String name ; private String phone ; private String email ; public void load(int id ) { DBConnector.loadPhone(id, this ); } public void save () { if (id == 0 ) { id = DBConnector.insertPhone(this ); } else { DBConnector.updatePhone(id, this ); } } //getters and setters… }
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 31. display_phone.jsp <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;> <%@ page import = &quot;edu.technion.methodologies.phones.*&quot; %> <HTML> <HEAD> <TITLE> Phone Entry </TITLE> </HEAD> <BODY> <% String idParam = request.getParameter( &quot;id&quot; ); int id = 0; if (idParam != null ){ id = Integer.parseInt(idParam); } PhoneEntry phoneEntry = new PhoneEntry(); phoneEntry.load(id); %> Handling the request Creating the JavaBean Importing libraries
  • 32.
  • 34.
  • 35.
  • 36. JSP Include – cont’d … <BODY> <%@ include file = &quot;header.jsp&quot; %> <% … We add the include declarative into display_phone.jsp And we get:
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. Model 2 Architecture – cont’d .jsp .jsp Form request forward Database classes servlet VIEW CONTROLLER MODEL
  • 42.
  • 43.