CS520 Web Programming Bits and Pieces of Web Programming (II) Chengyu Sun California State University, Los Angeles.

Slides:



Advertisements
Similar presentations
Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Advertisements

Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Servers- Apache Tomcat Server Server-side scripts- Java Server Pages Java Server Pages - Xue Bai.
Apache Struts Technology
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
An introduction to Java Servlet Programming
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
Java Server Pages B.Ramamurthy. Java Server Pages Servlets are pure Java programs. They introduce dynamism into web pages by using programmatic content.
Web programming for project students Dr Jim Briggs.
Building and Deploying a Simple Web Application. Tomcat and JSP Tomcat is an application server, commonly used to host JSP applications Applications are.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Julien Thibault / Phil Brewster / Kristina Doing-Harris
CS 160: Software Engineering August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Java web development Servlet & Java server pages.
Java Servlets and JSP.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Servlet and Tomcat Tutorial
Platform as a Service (PaaS)
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
ENTERPRISE JOB SCHEDULER SAJEEV RAMAKRISHNAN 29 AUG 2014.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 12 Electronic Mail.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
JBoss at Work JAW Motors Application Chapter 1-3 Jeff Schmitt October 9, 2006.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
JSP Most of the web developers deploying web applications using servlets mixes the presentation logic and business logic. Separation of business logic.
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
Mark Dixon 1 12 – Java Beans. Mark Dixon 2 Session Aims & Objectives Aims –To cover the use of Java Beans Objectives, by end of this week’s sessions,
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Two Installing and Configuring Exchange Server 2003.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
C HAPTER 11 D EPLOYING YOUR WEB APP. WAR FILE A WAR file is simply a snapshot of your web app structure, in a nice portable, compressed form (it is really.
CSC 2720 Building Web Applications JavaServer Pages (JSP) JSP Directives and Action Elements.
1 Introduction to Web Applications & APIs. 2 Agenda  Architecture of Web Applications Three layer architecture  Web Server (Tomcat) Installation Data.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Core basic Java web server technologies. Tools Eclipse IDE for Java EE Developers (Netbeans also works) nloads/packages/eclipse-
JAVA, JEE Training Introduction to Web Harinath Mallepally
Apache Struts Technology A MVC Framework for Java Web Applications.
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
BlueDragon Editions and Advantages Lori Pacheco New Atlanta.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Week-2 (Lecture-1) An electronic message sent from one computer to another. contains account i.e. How does.
//liveVirtualacademy2011/ What’s New for ASP.NET 4.5 and Web Development in Visual Studio 11 Developer Preview Γιώργος Καπνιάς MVP, MCT, MCDP, MCDBA, MCTS,
CS520 Web Programming Declarative Security (I) Chengyu Sun California State University, Los Angeles.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Bits and Pieces of Web Programming (I) Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
Deploying Web Applications to Tomcat Server Chun Guo
Chengyu Sun California State University, Los Angeles
CS3220 Web and Internet Programming Introduction to Java Servlets
Platform as a Service (PaaS)
CS3220 Web and Internet Programming RESTful Web Service
Platform as a Service (PaaS)
CS520 Web Programming Bits and Pieces of Web Programming (II)
Chengyu Sun California State University, Los Angeles
CS5220 Advanced Topics in Web Programming Spring – Web MVC
CS5220 Advanced Topics in Web Programming Spring – Web MVC
CS3220 Web and Internet Programming Introduction to Java Servlets
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
Presentation transcript:

CS520 Web Programming Bits and Pieces of Web Programming (II) Chengyu Sun California State University, Los Angeles

Roadmap Sending Task scheduling and execution View Template Framework Application deployment

Function in Web Applications Various notifications, e.g. order, payment, shipment, forum post and reply, account activities, and so on Advertisement campaigns and product promotions Password reset …

How Works SMTP, IMAP, POP Client AClient B Server A Server B ??

JavaMail amail/index.html Maven dependency: javax.mail:mail Properties props = System.getProperties(); props.put("mail.smtp.host", mailhost); Session session = Session.getInstance( props ); Message msg = new MimeMessage(session);... Transport.send( msg );

Set Up a Local Server for Testing hMailServer on Windows - cysun/course_materials/hmailserver cysun/course_materials/hmailserver postfix on Linux - cysun/notes/ubuntu_server# cysun/notes/ubuntu_server#

Spring Support Need spring-context-support dependency Declare a mailSender bean JavaMailSender interface JavaMailSender See CSNS2 for example Mail message classes Simpl Message  No attachment, no special character encoding Mim Message

Examples of Scheduled Tasks Periodic s, e.g. Information about weekly sale Forum daily digests Member newsletters Payment reminders Batch data processing

Concepts in Task Scheduling and Execution … Task Executor Use one thread for each task Use one thread for all tasks Use a thread pool Schedule (a.k.a. Trigger) E.g. every 5 minutes, every day at midnight, every first Sunday of each month at 8am …

… Concepts in Task Scheduling and Execution Scheduler Executor Task Schedule/Trigger

Spring Configuration namespace <task:executor id="executor" pool-size="5"/> <task:annotation-driven scheduler="scheduler" executor="executor" /> Creates a scheduler Creates a thread pool Based executor Enables

@Scheduled t/javadoc- api/org/springframework/scheduling/an notation/Scheduled.html

Cron Expression Six field separated by space 1. Seconds (0-59) 2. Minutes (0-59) 3. Hours (0-23) 4. Day of month (1-31) 5. Month (1-12 or JAN-DEC) 6. Day of week (1-7 or MON-SUN)

Cron Field Values Single value, e.g. 12 Set of values, e.g. 0,15,30,45 Range, e.g. 1-12,MON-FRI,* (first- last) Range with step, e.g. 1-12/3

Cron Expression Examples 0 0 * * * * 0 */10 * * * * * * MON-FRI ,15 * * Every hour at the beginning of the hour Every 10 minutes Every weekday at 8AM Every 1 st and 15 th of each month at 1AM

Apache Tiles A template framework for JSP Similar to Master Page and Razor in ASP.NET

The Need for View Templates Header Footer Content 1 Header Footer Content N page1.jsppageN.jsp

Why JSP Is Not Enough It breaks HTML syntax, e.g. in header.jsp and in footer.jsp. It’s difficult to create and manage multiple complex templates.

Basic Tiles Usage Template page = JSP + placeholders (i.e. attributes), Content: JSP, string, other tiles Definition: combine template and content Tiles Tag Library

A Tiles Example Header Footer Content 1 Header Footer Content 2 page1.jsppage2.jsp

Tiles – Template Page Header Footer template.jsp

Tiles – Content Pages Content 1Content 2 page1.jsppage2.jsp

Tiles – Definitions

Resolve Tiles Views in Spring /WEB-INF/tiles.xml

Tiles Usage in CSNS2 WEB-INF/layout for template and header/footer pages WEB-INF/content for content pages WEB-INF/tiles.xml for definitions

Application Deployment Computer for Development Server Hosting the Web Application Deploy Application

Directory Structure of a Java Web Application Application Root Directory WEB-INF JSPs and static resources classes web.xml lib Compiled Java classes Additional Java libraries

WAR Files Web application ARchive A JAR file for packaging, distributing, and deploying Java web applications Create WAR files The command line tool jar Eclipse Export -> Web -> WAR file mvn package

Deploy WAR Files to a Tomcat Server Copy the WAR file to the webapps folder Use the Manager App Need a user with the manager-gui role More options at doc/deployer-howto.html doc/deployer-howto.html