MTAT Enterprise System Integration

Size: px
Start display at page:

Download "MTAT Enterprise System Integration"

Transcription

1 MTAT Enterprise System Integration Lecture 4: Presentation Layer Luciano García-Bañuelos University of Tartu

2 The picture Enterprise sozware Presenta(on Controller Applica4on logic Model Data access How to organize the code that implements the interac4ons with end- users? MVC Pa<ern Model: consists of applica4on data and business logic : any output representa4on of data (e.g., Chart diagrams, GUIs Java swing, HTML pages) Controller: Mediates user interac4on, conver4ng it to commands for the model or view Worth asking: Layered architecture? Logical boundaries? PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 1

3 A closer look to MVC The MVC pa<ern has its roots on the early a<empts to developing Graphical User Interfaces Introduced in Smalltalk- 76, in Xerox Park, in the 70 s Re- implemented later in Smalltalk- 80 s class library, in the 80 s State Query Model Encapsulates applica4on state Responds to state queries Exposes applica4on func4onality No4fies views changes Change No*fica*on State Change Renders the models Requests updates from models Sends user gestures to controller Allows controller to select view Selec(on User Gestures Controller Defines applica4on behavior Maps user ac4ons to model updates Selects view for response One for each func4onality Source: Oracle PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 2

4 Java Web Applications HTTP verbs Get Post Update Delete URL h<p://example.com/app?name=adam Web Server Client (e.g., Web browser) HTTP request HTTP response Servlet container Servlet Status code 200, 201, 404, 500, etc. + content (e.g., HTML, XML, JSON) PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 3

5 Hello world, Servlets h<p://example.com/app?name=adam public class HelloWorld extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getparameter("name"); PrintWriter response.setcontenttype("text/html"); out = response.getwriter(); out.println("hello PrintWriter = response.getwriter(); world, " + name); } } out.println("<html>"); out.println("<head><title>hello world</title></head>"); out.println("<body><h1>hello " + name + "</H1></BODY>"); out.println("/<html>"); } } PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 4

6 MVC revisited: The Struts 2 architecture Web Server JSP/Servlet container Ac(on Client HTTP request HTTP response Dispatcher filter Servlet Interceptor Servlet Servlet Servlet Model Model Model JSP compiled into Controller Servlet PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 5

7 Spring MVC architecture Spring MVC container Web Server HTTP request Interc. Interc.... URL Handler mapping Client Dispatcher Controller Model HTTP response Model logical name logical name resolver PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 6

8 Hands-on with Spring MVC PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 7

9 Scenario Once the works engineer has approved the plant hire request, Buildit s informa4on system automa4cally generates a Purchase Order (PO) for hiring the plant and sends this PO to the plant supplier. Some4mes, the site engineer requests an extension of the period of engagement (e.g. in order to keep the plant for an addi4onal week). In order to request an engagement, the site engineer should first check the availability of the plant with the supplier for the period of the extension. If the plant is available, the site engineer can modify the plant hire request. Buildit s informa4on system then sends a modified PO to the supplier. PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 8

10 Scenario Customer name: String vatnumber: String PurchaseOrder start: Date end: Date cost: Float Plant name: String description: String price: Float PurchaseOrder ID START END COST C_ID P_ID /23/13 09/27/ Plant ID NAME DESC PRICE 123 Excavator h<p://ren4t.com/po/updaterp?po=115&ndays=3 PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 9

11 The dispatcher servlet Dispatcher Controller resolver <bean class="org.springframework.web.servlet.handler.simplemappingexceptionresolver p:defaulterror="uncaughtexception"> <property name="exceptionmappings"> <props> <prop key=".dataaccessexception">dataaccessfailure</prop> <prop key=".nosuchrequesthandlingmethodexception">resourcenotfound</prop> <prop key=".typemismatchexception">resourcenotfound</prop> <prop key=".missingservletrequestparameterexception">resourcenotfound</prop> </props> </property> </bean> PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 10

12 public class PurchaseOrder updaterp", method = public String updaterentperiod(httpservletrequest request, Model model) throws Exception { String poidstr = request.getparameter("po"); Long poid = Long.valueOf(poIdStr); String numofdaysstr = request.getparameter("ndays"); Integer numofdays = Integer.valueOf(plantIdStr); PurchaseOrder po = PurchaseOrder.find(poId); // Compute rent extension period if (po.plant.isavailable(extensionperiod)) { po.setenddate(newenddate); // Update the cost model.addattribute( purchaseorder", po); adddatetimeformatpatterns(model); } else throw new Exception("The plant is not available for the requested period"); return po/show"; } } PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 11

13 @RooWebScaffold(path = po", formbackingobject = PurchaseOrder.class) public class PurchaseOrder method = public String updaterentperiod(@requestparam("po") Long ndays") Integer numofdays, Model model) throws Exception { PurchaseOrder po = PurchaseOrder.find(poId); // Compute rent extension period if (po.plant.isavailable(extensionperiod)) { po.setenddate(newenddate); // Update the cost model.addattribute( purchaseorder", po); adddatetimeformatpatterns(model); } else throw new Exception("The plant is not available for the requested period"); return po/show"; } } PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 12

14 Model Spring uses a hash table to carry up the informa4on to be rendered by the view: Objects in the Model may be instances of wrapped primi4ve data or JavaBeans JavaBeans are reusable Java components. They are serializable, have a 0- argument constructor, and allow access to proper4es via ge<er/ se<er methods. public String updaterentperiod(..., Model model,...) {... model.addattribute( purchaseorder", po);... public class Query{ = "M-") = "M- ) Date enddate; } PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 13

15 The view resolver resolvers provided by Spring: BeanNameResolver ContentNego4a4ngResolver FreeMarkerResolver InternalResourceResolver JasperReportsResolver ResourceBundleResolver TilesResolver UrlBasedResolver VelocityLayoutResolver VelocityResolver XmlResolver XsltResolver Dispatcher Controller resolver PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 14

16 Composing the view with Tiles <tiles-definitions> <definition name="default" template="/web-inf/layouts/default.jspx"> <put-attribute name="header" value="/web-inf/views/header.jspx" /> <put-attribute name="menu" value="/web-inf/views/menu.jspx" /> <put-attribute name="footer" value="/web-inf/views/footer.jspx" /> </definition> <definition name="public" template="/web-inf/layouts/default.jspx"> <put-attribute name="header" value="/web-inf/views/header.jspx" /> <put-attribute name="footer" value="/web-inf/views/footer.jspx" /> </definition> </tiles-definitions> PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 15

17 Composing the view with Tiles <tiles-definitions> <definition extends="default" name="plants/list"> <put-attribute name="body" value="/web-inf/views/plants/list.jspx"/> </definition> <definition extends="default" name="plants/show"> <put-attribute name="body" value="/web-inf/views/plants/show.jspx"/> </definition> <definition extends="default" name="plants/create"> <put-attribute name="body" value="/web-inf/views/plants/create.jspx"/> </definition> <definition extends="default" name="plants/update"> <put-attribute name="body" value="/web-inf/views/plants/update.jspx"/> </definition> </tiles-definitions> PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 16

18 Sample view: plants/create <?xml version="1.0" encoding="utf-8" standalone="no"?> <div xmlns:c=" xmlns:field="urn:jsptagdir:/web-inf/tags/form/fields" xmlns:form="urn:jsptagdir:/web-inf/tags/form" xmlns:jsp=" xmlns:spring=" version="2.0"> <jsp:directive.page contenttype="text/html;charset=utf-8"/> <jsp:output omit-xml-declaration="yes"/> <form:create id="fc_pkg_domain_plant" modelattribute="plant" path="/plants" render="${empty dependencies}" z="0m7wtjjf0//c/2xp9wcunjd/eg4= > <field:textarea field="name" id="c_pkg_domain_plant_name" required="true" z="+emqaiehqntpd4m4ne1d93trkm4="/> <field:textarea field="description" id="c_pkg_domain_plant_description" required="true" z="foolsp+shi2yhfle7uaiwqmbgv8="/> <field:input decimalmin="0.01" field="price" id="c_pkg_domain_plant_price" required="true" validationmessagecode="field_invalid_number" z="avuyqaa2ldelczydu27c9kg2ark="/> </form:create> <form:dependency dependencies="${dependencies}" id="d_pkg_domain_plant" render="${not empty dependencies}" z="+akd7un/uypdkxdvrvkhb5fy3nc="/> </div> PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 17

19 Sample view with Spring tags <?xml version="1.0" encoding="utf-8" standalone="no"?> <div xmlns:form=" xmlns:jsp=" version="2.0"> <jsp:directive.page contenttype="text/html;charset=utf-8" /> <jsp:output omit-xml-declaration="yes" /> <spring:url value="plants/create2" var="plant_creation_url" /> <form:form method="post" action="${plant_creation_url}" modelattribute="plant"> <table> <tr> <td>name:</td><td><form:input path="name" /></td> </tr> <tr> <td>description:</td><td><form:input path="description" /></td> </tr> <tr> <td>price:</td><td><form:input path="price" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="save" /></td> </tr> </table> </form:form> </div> create2.jspx PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 18

20 Sample page flow GET h<p://.../plants?create Redirect to JSPX view h<p://.../plants/create2 POST h<p://.../plants/create2 Redirect to ac4on on Controller h<p://.../plants/{plantid} <tiles-definitions> <definition extends="default" name="plants/list"> <put-attribute name="body" value="/web-inf/views/plants/list.jspx"/> </definition> <definition extends="default" name="plants/show"> <put-attribute name="body" value="/web-inf/views/plants/show.jspx"/> </definition> <definition extends="default" name="plants/create"> <put-attribute name="body" value="/web-inf/views/plants/create.jspx"/> </definition> <definition extends="default" name="plants/update"> <put-attribute name="body" value="/web-inf/views/plants/update.jspx"/> </definition> <definition extends="default" name="plants/create2"> <put-attribute name="body" value="/web-inf/views/plants/create2.jspx"/> </definition> </tiles-definitions> PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 19

21 Sample view with public class PlantController = "create") public String createform(model model) { model.addattribute("plant", new Plant()); return "plants/create2"; } GET h<p://.../plants?create Redirect to = "create2", method = RequestMethod.POST) public String create(@valid Plant plant, BindingResult bindingresult, Model model, HttpServletRequest request) { if (bindingresult.haserrors()) { model.addattribute("plant", new Plant()); return "plants/create2"; } model.asmap().clear(); plant.persist(); return "redirect:/plants/" + encodeurlpathsegment(plant.getid().tostring(), request); } } PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 20

22 Sample view with Spring tags <?xml version="1.0" encoding="utf-8" standalone="no"?> <div xmlns:form=" xmlns:jsp=" version="2.0"> <jsp:directive.page contenttype="text/html;charset=utf-8" /> <jsp:output omit-xml-declaration="yes" /> <spring:url value="plants/create2" var="plant_creation_url" /> <form:form method="post" action="${plant_creation_url}" modelattribute="plant"> <table> <tr> <td>name:</td><td><form:input path="name" /></td> </tr> <tr> <td>description:</td><td><form:input path="description" /></td> </tr> <tr> <td>price:</td><td><form:input path="price" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="save" /></td> </tr> </table> </form:form> </div> GET h<p://.../plants?create Redirect to JSPX view h<p://.../plants/create2 POST h<p://.../plants/create2 PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 21

23 Sample view with public class PlantController { = "create") public String createform(model model) { model.addattribute("plant", new Plant()); return "plants/create2"; } GET = "create2", method = RequestMethod.POST) public String create(@valid Plant plant, BindingResult bindingresult, Model model, HttpServletRequest request) { if (bindingresult.haserrors()) { model.addattribute("plant", new Plant()); return "plants/create2"; } model.asmap().clear(); plant.persist(); return "redirect:/plants/" + encodeurlpathsegment(plant.getid().tostring(), request); } Redirect to JSPX view h<p://.../plants/create2 POST h<p://.../plants/create2 Redirect to ac4on on Controller h<p://.../plants/{plantid} PRESENTATION LAYER LUCIANO GARCÍA- BAÑUELOS 22

MTAT Enterprise System Integration

MTAT Enterprise System Integration MTAT.03.229 Enterprise System Integration Lecture 3: Services and Presentation layer Luciano García-Bañuelos University of Tartu Hexagonal architecture Last week: Domain model Structural patterns: Entities,

More information

MTAT Enterprise System Integration

MTAT Enterprise System Integration MTAT.03.229 Enterprise System Integration Lecture 3: Services and Presentation layer Luciano García-Bañuelos University of Tartu Hexagonal architecture Last week: Domain model Structural patterns: Entities,

More information

MTAT Enterprise System Integration

MTAT Enterprise System Integration MTAT.03.229 Enterprise System Integration Lecture 7: Hypermedia REST Luciano García-Bañuelos University of Tartu Richardson s Maturity Level 2 Also known as CRUD services Mul5ple URIs, mul5ple HTTP verbs,

More information

The picture. Security is a cri,cal concern to take into account during the development of enterprise so8ware

The picture. Security is a cri,cal concern to take into account during the development of enterprise so8ware The picture Enterprise so8ware Presenta,on Presenta,on Integra,on layer Applica,on logic Applica,on logic Data access Data access Security is a cri,cal concern to take into account during the development

More information

MTAT Enterprise System Integration

MTAT Enterprise System Integration MTAT.03.229 Enterprise System Integration Lecture 3: Data access Layer Luciano García-Bañuelos University of Tartu The picture Enterprise sosware Presenta@on Applica@on logic Data access layer Persistence

More information

JavaServer Pages (JSP)

JavaServer Pages (JSP) JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult

More information

CE212 Web Application Programming Part 3

CE212 Web Application Programming Part 3 CE212 Web Application Programming Part 3 30/01/2018 CE212 Part 4 1 Servlets 1 A servlet is a Java program running in a server engine containing methods that respond to requests from browsers by generating

More information

MTAT Enterprise System Integration

MTAT Enterprise System Integration MTAT.03.229 Enterprise System Integration Lecture 6: Hypermedia REST Luciano García- Bañuelos University of Tartu Richardson s Maturity Level 2 Also known as CRUD services Multiple URIs, multiple HTTP

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a

More information

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC) Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller

More information

Mastering Spring MVC 3

Mastering Spring MVC 3 Mastering Spring MVC 3 And its @Controller programming model Get the code for the demos in this presentation at http://src.springsource.org/svn/spring-samples/mvc-showcase 2010 SpringSource, A division

More information

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat

More information

Introduction to Servlets. After which you will doget it

Introduction to Servlets. After which you will doget it Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,

More information

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation

Welcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management

More information

Session 9. Introduction to Servlets. Lecture Objectives

Session 9. Introduction to Servlets. Lecture Objectives Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the

More information

Servlet Basics. Agenda

Servlet Basics. Agenda Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

Session 10. Form Dataset. Lecture Objectives

Session 10. Form Dataset. Lecture Objectives Session 10 Form Dataset Lecture Objectives Understand the relationship between HTML form elements and parameters that are passed to the servlet, particularly the form dataset 2 10/1/2018 1 Example Form

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Web Programming. Lecture 11. University of Toronto

Web Programming. Lecture 11. University of Toronto CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat University of Toronto Servlets+JSP Model 2 Architecture University of Toronto 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern

More information

1Z Java EE 6 Web Component Developer Certified Expert Exam Summary Syllabus Questions

1Z Java EE 6 Web Component Developer Certified Expert Exam Summary Syllabus Questions 1Z0-899 Java EE 6 Web Component Developer Certified Expert Exam Summary Syllabus Questions Table of Contents Introduction to 1Z0-899 Exam on Java EE 6 Web Component Developer Certified Expert... 2 Oracle

More information

~$> whoami. Ioan Marius Curelariu SDE at Website Analytics Amazon Development Center Romania

~$> whoami. Ioan Marius Curelariu SDE at Website Analytics Amazon Development Center Romania MVC on the WEB ~$> whoami Ioan Marius Curelariu SDE at Website Analytics Amazon Development Center Romania The Server Side Story The Server Side Story Elastic Beanstalk The Spring Framework First described

More information

JAVA SERVLET. Server-side Programming INTRODUCTION

JAVA SERVLET. Server-side Programming INTRODUCTION JAVA SERVLET Server-side Programming INTRODUCTION 1 AGENDA Introduction Java Servlet Web/Application Server Servlet Life Cycle Web Application Life Cycle Servlet API Writing Servlet Program Summary 2 INTRODUCTION

More information

Session 25. Spring Controller. Reading & Reference

Session 25. Spring Controller. Reading & Reference Session 25 Spring Controller 1 Reading Reading & Reference www.tutorialspoint.com/spring/spring_web_mvc_framework.htm https://springframework.guru/spring-requestmapping-annotation/ Reference Spring home

More information

CSC309: Introduction to Web Programming. Lecture 11

CSC309: Introduction to Web Programming. Lecture 11 CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat Servlets+JSP Model 2 Architecture 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern 3 Servlets+JSP Model 2 Architecture Controller

More information

Page 1

Page 1 Java 1. Core java a. Core Java Programming Introduction of Java Introduction to Java; features of Java Comparison with C and C++ Download and install JDK/JRE (Environment variables set up) The JDK Directory

More information

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module Java Platform, Enterprise Edition 5 (Java EE 5) Core Java EE Java EE 5 Platform Overview Java EE Platform Distributed Multi tiered Applications Java EE Web & Business Components Java EE Containers services

More information

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003 Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Session 20 Data Sharing Session 20 Data Sharing & Cookies

Session 20 Data Sharing Session 20 Data Sharing & Cookies Session 20 Data Sharing & Cookies 1 Reading Shared scopes Java EE 7 Tutorial Section 17.3 Reference http state management www.ietf.org/rfc/rfc2965.txt Cookies Reading & Reference en.wikipedia.org/wiki/http_cookie

More information

Lab session Google Application Engine - GAE. Navid Nikaein

Lab session Google Application Engine - GAE. Navid Nikaein Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone

More information

SPRING - EXCEPTION HANDLING EXAMPLE

SPRING - EXCEPTION HANDLING EXAMPLE SPRING - EXCEPTION HANDLING EXAMPLE http://www.tutorialspoint.com/spring/spring_exception_handling_example.htm Copyright tutorialspoint.com The following example show how to write a simple web based application

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming

More information

Advanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans

Advanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans University of New York, Tirana M.Sc. Computer Science Advanced Topics in Operating Systems Manual for Lab Practices Enterprise JavaBeans PART III A Web Banking Application with EJB and MySQL Development

More information

Distributed Multitiered Application

Distributed Multitiered Application Distributed Multitiered Application Java EE platform uses a distributed multitiered application model for enterprise applications. Logic is divided into components https://docs.oracle.com/javaee/7/tutorial/overview004.htm

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

Advanced Internet Technology Lab # 4 Servlets

Advanced Internet Technology Lab # 4 Servlets Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:

More information

CIS 3952 [Part 2] Java Servlets and JSP tutorial

CIS 3952 [Part 2] Java Servlets and JSP tutorial Java Servlets Example 1 (Plain Servlet) SERVLET CODE import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet;

More information

Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json

Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json A Servlet used as an API for data Let s say we want to write a Servlet

More information

Session 24. Spring Framework Introduction. Reading & Reference. dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p

Session 24. Spring Framework Introduction. Reading & Reference. dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p Session 24 Spring Framework Introduction 1 Reading & Reference Reading dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p http://engineering.pivotal.io/post/must-know-spring-boot-annotationscontrollers/

More information

Using Java servlets to generate dynamic WAP content

Using Java servlets to generate dynamic WAP content C H A P T E R 2 4 Using Java servlets to generate dynamic WAP content 24.1 Generating dynamic WAP content 380 24.2 The role of the servlet 381 24.3 Generating output to WAP clients 382 24.4 Invoking a

More information

JAVA Training Overview (For Demo Classes Call Us )

JAVA Training Overview (For Demo Classes Call Us ) JAVA Training Overview (For Demo Classes Call Us +91 9990173465) IT SPARK - is one of the well-known and best institutes that provide Java training courses. Working professionals from MNC's associated

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets

Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets ID2212 Network Programming with Java Lecture 10 Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets Leif Lindbäck, Vladimir Vlassov KTH/ICT/SCS HT 2015

More information

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes Java CORE JAVA Core Java Programing (Course Duration: 40 Hours) Introduction to Java What is Java? Why should we use Java? Java Platform Architecture Java Virtual Machine Java Runtime Environment A Simple

More information

Implementation Architecture

Implementation Architecture Implementation Architecture Software Architecture VO/KU (707023/707024) Roman Kern ISDS, TU Graz 2017-11-15 Roman Kern (ISDS, TU Graz) Implementation Architecture 2017-11-15 1 / 54 Outline 1 Definition

More information

ServletConfig Interface

ServletConfig Interface ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Ch04 JavaServer Pages (JSP)

Ch04 JavaServer Pages (JSP) Ch04 JavaServer Pages (JSP) Introduce concepts of JSP Web components Compare JSP with Servlets Discuss JSP syntax, EL (expression language) Discuss the integrations with JSP Discuss the Standard Tag Library,

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

CS433 Technology Overview

CS433 Technology Overview CS433 Technology Overview Scott Selikoff Cornell University November 13, 2002 Outline I. Introduction II. Stored Procedures III. Java Beans IV. JSPs/Servlets V. JSPs vs. Servlets VI. XML Introduction VII.

More information

Stateless -Session Bean

Stateless -Session Bean Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

Getting Data from the User with Forms. A Basic Form-Submission Workflow

Getting Data from the User with Forms. A Basic Form-Submission Workflow Getting Data from the User with Forms Providing the ability to capture user data is critical for most dynamic web applications. Users often need to register for a user account in order to access certain

More information

Overview of last week

Overview of last week Overview of last week PODTO PlantDTO SalesController SalesService Application Web UI adapter PurchaseOrder OrdersRepository Domain model JPA adapter Plant PlantRepository DDD & DATA ACCESS LUCIANO GARCÍA-BAÑUELOS

More information

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests What is the servlet? Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

More information

Spring MVC Command Beans As Complex As You Need

Spring MVC Command Beans As Complex As You Need Visit: www.intertech.com/blog Spring MVC Command Beans As Complex As You Need One of the complex Spring MVC user interfaces deals with showing multiple records in an HTML table and allowing users to randomly

More information

Backend. (Very) Simple server examples

Backend. (Very) Simple server examples Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));

More information

Servlets and JSP (Java Server Pages)

Servlets and JSP (Java Server Pages) Servlets and JSP (Java Server Pages) XML HTTP CGI Web usability Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Servlets Generic Java2EE API for invoking and connecting to mini-servers (lightweight,

More information

Model-View-Controller. and. Struts 2

Model-View-Controller. and. Struts 2 Model-View-Controller and Struts 2 Problem area Mixing application logic and markup is bad practise Harder to change and maintain Error prone Harder to re-use public void doget( HttpServletRequest request,

More information

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java COURSE DETAILS: CORE AND ADVANCE JAVA Core Java 1. Object Oriented Concept Object Oriented Programming & its Concepts Classes and Objects Aggregation and Composition Static and Dynamic Binding Abstract

More information

The Struts MVC Design. Sample Content

The Struts MVC Design. Sample Content Struts Architecture The Struts MVC Design Sample Content The Struts t Framework Struts implements a MVC infrastructure on top of J2EE One Servlet acts as the Front Controller Base classes are provided

More information

********************************************************************

******************************************************************** ******************************************************************** www.techfaq360.com SCWCD Mock Questions : Servlet ******************************************************************** Question No :1

More information

JAVA SERVLET. Server-side Programming PROGRAMMING

JAVA SERVLET. Server-side Programming PROGRAMMING JAVA SERVLET Server-side Programming PROGRAMMING 1 AGENDA Passing Parameters Session Management Cookie Hidden Form URL Rewriting HttpSession 2 HTML FORMS Form data consists of name, value pairs Values

More information

Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 21 st May Time:

Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 21 st May Time: COMP67032 Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Building Web Applications Date: Friday 21 st May 2010 Time: 14.00 17.00 Answer Question 1 from Section A and TWO questions out

More information

Implementation Architecture

Implementation Architecture Implementation Architecture Software Architecture VO/KU (707023/707024) Roman Kern KTI, TU Graz 2014-11-19 Roman Kern (KTI, TU Graz) Implementation Architecture 2014-11-19 1 / 53 Outline 1 Definition 2

More information

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4 CMPUT 391 Database Management Systems The Basic Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems

More information

Java TM. JavaServer Faces. Jaroslav Porubän 2008

Java TM. JavaServer Faces. Jaroslav Porubän 2008 JavaServer Faces Jaroslav Porubän 2008 Web Applications Presentation-oriented Generates interactive web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response

More information

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features

More information

HTTP status codes. Setting status of an HTTPServletResponse

HTTP status codes. Setting status of an HTTPServletResponse HTTP status codes Setting status of an HTTPServletResponse What are HTTP status codes? The HTTP protocol standard includes three digit status codes to be included in the header of an HTTP response. There

More information

Develop an Enterprise Java Bean for Banking Operations

Develop an Enterprise Java Bean for Banking Operations Develop an Enterprise Java Bean for Banking Operations Aim: Develop a Banking application using EJB3.0 Software and Resources: Software or Resource Version Required NetBeans IDE 6.7, Java version Java

More information

Component Based Software Engineering

Component Based Software Engineering Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts

More information

Scheme G Sample Question Paper Unit Test 2

Scheme G Sample Question Paper Unit Test 2 Scheme G Sample Question Paper Unit Test 2 Course Name: Computer Engineering Group Course Code: CO/CD/CM/CW/IF Semester: Sixth Subject Title: Advanced Java Programming Marks: 25 Marks 17625 ---------------------------------------------------------------------------------------------------------------------------

More information

Handling Cookies. Agenda

Handling Cookies. Agenda Handling Cookies 1 Agenda Understanding the benefits and drawbacks of cookies Sending outgoing cookies Receiving incoming cookies Tracking repeat visitors Specifying cookie attributes Differentiating between

More information

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format. J2EE Development Detail: Audience www.peaksolutions.com/ittraining Java developers, web page designers and other professionals that will be designing, developing and implementing web applications using

More information

Spring MVC. Richard Paul Kiwiplan NZ Ltd 27 Mar 2009

Spring MVC. Richard Paul Kiwiplan NZ Ltd 27 Mar 2009 Spring MVC Richard Paul Kiwiplan NZ Ltd 27 Mar 2009 What is Spring MVC Spring MVC is the web component of Spring's framework. Model - The data required for the request. View - Displays the page using the

More information

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD W HI TEPAPER www. p rogres s.com WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD In this whitepaper, we describe how to white label Progress Rollbase private cloud with your brand name by following a

More information

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among

More information

COURSE 9 DESIGN PATTERNS

COURSE 9 DESIGN PATTERNS COURSE 9 DESIGN PATTERNS CONTENT Applications split on levels J2EE Design Patterns APPLICATION SERVERS In the 90 s, systems should be client-server Today, enterprise applications use the multi-tier model

More information

Chapter 2 How to structure a web application with the MVC pattern

Chapter 2 How to structure a web application with the MVC pattern Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.

More information

Java Server Pages JSP

Java Server Pages JSP Java Server Pages JSP Agenda Introduction JSP Architecture Scripting Elements Directives Implicit Objects 2 A way to create dynamic web pages Introduction Separates the graphical design from the dynamic

More information

Handout 31 Web Design & Development

Handout 31 Web Design & Development Lecture 31 Session Tracking We have discussed the importance of session tracking in the previous handout. Now, we ll discover the basic techniques used for session tracking. Cookies are one of these techniques

More information

1.264 Lecture 15. Web development environments: JavaScript Java applets, servlets Java (J2EE) Active Server Pages

1.264 Lecture 15. Web development environments: JavaScript Java applets, servlets Java (J2EE) Active Server Pages 1.264 Lecture 15 Web development environments: JavaScript Java applets, servlets Java (J2EE) Active Server Pages Development environments XML, WSDL are documents SOAP is HTTP extension UDDI is a directory/registry

More information

Advanced Web Technology

Advanced Web Technology Berne University of Applied Sciences Dr. E. Benoist Winter Term 2005-2006 Presentation 1 Presentation of the Course Part Java and the Web Servlet JSP and JSP Deployment The Model View Controler (Java Server

More information

3. The pool should be added now. You can start Weblogic server and see if there s any error message.

3. The pool should be added now. You can start Weblogic server and see if there s any error message. CS 342 Software Engineering Lab: Weblogic server (w/ database pools) setup, Servlet, XMLC warming up Professor: David Wolber (wolber@usfca.edu), TA: Samson Yingfeng Su (ysu@cs.usfca.edu) Setup Weblogic

More information

Integrating Servlets and JavaServer Pages Lecture 13

Integrating Servlets and JavaServer Pages Lecture 13 Integrating Servlets and JavaServer Pages Lecture 13 Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall,

More information

Java4570: Session Tracking using Cookies *

Java4570: Session Tracking using Cookies * OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract

More information

Making applica+ons with Java. Text Technologies 2013 Chris Culy

Making applica+ons with Java. Text Technologies 2013 Chris Culy Making applica+ons with Java Desktop applica+on aka executable jar file Commandline: java jar myapplica+on.jar Or, if you have a GUI interface, doubleclick on the jar file Easiest solu+on: Let the IDE

More information

SSC - Web applications and development Introduction and Java Servlet (I)

SSC - Web applications and development Introduction and Java Servlet (I) SSC - Web applications and development Introduction and Java Servlet (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics What will we learn

More information

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet. Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;

More information

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

Developing a Mobile Web-based Application with Oracle9i Lite Web-to-Go

Developing a Mobile Web-based Application with Oracle9i Lite Web-to-Go Developing a Mobile Web-based Application with Oracle9i Lite Web-to-Go Christian Antognini Trivadis AG Zürich, Switzerland Introduction More and more companies need to provide their employees with full

More information

CSC309: Introduction to Web Programming. Lecture 10

CSC309: Introduction to Web Programming. Lecture 10 CSC309: Introduction to Web Programming Lecture 10 Wael Aboulsaadat WebServer - WebApp Communication 2. Servlets Web Browser Get servlet/serv1? key1=val1&key2=val2 Web Server Servlet Engine WebApp1 serv1

More information

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold.

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold. 1. Application Servers J2EE Web Development In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Agenda Application servers What is J2EE? Main

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype=text/html; charset=windows-31j import=java.util.calendar %> A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp

More information

Université du Québec à Montréal

Université du Québec à Montréal Laboratoire de Recherches sur les Technologies du Commerce Électronique arxiv:1803.05253v1 [cs.se] 14 Mar 2018 Université du Québec à Montréal How to Implement Dependencies in Server Pages of JEE Web Applications

More information

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition CMP 436/774 Introduction to Java Enterprise Edition Fall 2013 Department of Mathematics and Computer Science Lehman College, CUNY 1 Java Enterprise Edition Developers today increasingly recognize the need

More information