Slides © Marty Hall, book © Sun Microsystems Press 1 Including Files & Applets in JSP Documents Core Servlets & JSP book:

Slides:



Advertisements
Similar presentations
Java Script Session1 INTRODUCTION.
Advertisements

J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
DT228/3 Web Development JSP: Directives and Scripting elements.
Including Files & Applets in JSP Documents Parts of this presentation provided by: Vijayan Sugumaran Decision and Information Sciences.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
Java Server Pages CS-422. What are JSPs A logical evolution of java servlets –most servlets dynamically create HTML and integrate it with some computational.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
4.1 JavaScript Introduction
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 APPENDIX D OVERVIEW OF JSP, JSTL, and EL TAGS. 2 OVERVIEW OF JSP, JSTL, and EL TAGS This appendix describes how to create and modify JSP pages in JD.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
CSC 2720 Building Web Applications Using Java Beans, Custom Tags and Tag Libraries in JSP pages.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
Chapter 5 HTTP Request Headers. Content 1.Request headers 2.Reading Request Headers 3.Making a Table of All Request Headers 4.Sending Compressed Web Pages.
Introduction to Applets CS 3505 Client Side Scripting with applets.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Slides © Marty Hall, book © Sun Microsystems Press 1 JSP Scripting Elements Core Servlets & JSP book:
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
CSC 2720 Building Web Applications JavaServer Pages (JSP) JSP Directives and Action Elements.
JSP. Types of JSP Scripting Elements Expressions of the form, which are evaluated and inserted into the servlet's output. Scriptlets of the form, which.
Web Technologies Java Beans & JSP By Praveen Kumar G.
Slides © Marty Hall, book © Sun Microsystems Press 1 Using JavaBeans with JSP Core Servlets & JSP book:
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Chapter 14 Using JavaBeans Components in JSP Documents.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Module 1 Introduction to JavaScript
Introduction to Advanced Java Programming
Java Server Pages By: Tejashri Udavant..
Including Files and Applets in JSP Pages
JAR Files Objectives: 1. Archiving and Packaging Java Code
Invoking Java Code from JSP
Chapter 27 WWW and HTTP.
INCLUDING FILES AND APPLETS IN JSP PAGES K. Phani Sirisha
Java Server Pages (JSP)
Java Server Pages B.Ramamurthy.
Introduction to JSP Dept. of B.Voc Software Development and System Administration St. Joseph’s College(Autonomous) Trichy-02 By Dr. J. Ronald Martin Introduction.
Web Technologies Java Beans & JSP
Presentation transcript:

Slides © Marty Hall, book © Sun Microsystems Press 1 Including Files & Applets in JSP Documents Core Servlets & JSP book: More Servlets & JSP book: Servlet and JSP Training Courses: courses.coreservlets.com

Including Files and Applets2 Agenda Including the output of JSP, HTML or plain text pages at the time the client requests the page Including JSP files at the time the main page is translated into a servlet Including applets that use the Java Plug-In

Including Files and Applets3 Including Files at Request Time Format – Purpose –To reuse JSP, HTML, or plain text content –JSP content cannot affect main page: only output of included JSP page is used –To permit updates to the included content without changing the main JSP page(s) Notes –You are not permitted to specify false for the flush attribute in JSP 1.1 and earlier –Don't forget that trailing slash

Including Files and Applets4 Including Files: Example Code... What's New at JspNews.com Here is a summary of our four most recent news stories:

Including Files and Applets5 Including Files: Example Result

Including Files and Applets6 Including Files at Page Translation Time Format – Purpose –To reuse JSP content in multiple pages, where JSP content affects main page Notes –Servers are not required to detect changes to the included file, and in practice they don't. –Thus, you need to change the JSP files whenever the included file changes. –You can use OS-specific mechanisms such as the Unix "touch" command, or

Including Files and Applets7 Differences Between jsp:include jsp:include includes the output of the designated page includes the actual code jsp:include occurs at request time occurs at page translation time With jsp:include, the main page and the included page become two separate servlets they become parts of a single servlet jsp:include automatically handles changes to the included file might not (big maintenance problem!)

Including Files and Applets8 Reusable JSP Content: ContactSection.jsp <%-- The following become fields in each servlet that results from a JSP page that includes this file. --%> <%! private int accessCount = 0; private Date accessDate = new Date(); private String accessHost = " No previous access "; %> This page © 2000 my-company.com. This page has been accessed times since server reboot. It was last accessed from at.

Including Files and Applets9 Using the JSP Content... Some Random Page Information about our products and services. Blah, blah, blah. Yadda, yadda, yadda.

Including Files and Applets10 Using the JSP Content: Result

Including Files and Applets11 Including Applets for the Java Plug-In Neither Netscape 4 nor IE 5/6 support Java 2 –Netscape 6 supports JDK 1.3 Problems using applets –In order to use Swing, you must send the Swing files over the network. This process is time consuming and fails in Internet Explorer 3 and Netscape 3.x and (which only support JDK 1.02). –You cannot use Java 2D –You cannot use the Java 2 collections package –Your code runs more slowly, since most compilers for the Java 2 platform are significantly improved over their 1.1 predecessors

Including Files and Applets12 Solution (?) Use the Java Plug-In Only a viable option for intranets –Requires each client to install large browser plug-in Cannot use simple APPLET tag Need long and ugly OBJECT tag for Internet Explorer Need long and ugly EMBED tag for Netscape The jsp:plugin action lets you write a simple tag that gets translated into the OBJECT and EMBED tags that are required –Warning: jsp:plugin fails in JRun 3 SP2

Including Files and Applets13 Using jsp:plugin APPLET Tag – Equivalent jsp:plugin – Reminder –JSP element and attribute names are case sensitive –All attribute values must be in single or double quotes –This is like XML but unlike HTML

Including Files and Applets14 Attributes of the jsp:plugin Element type –For applets, this should be "applet". Use "bean" to embed JavaBeans elements in Web pages. code –Used identically to CODE attribute of APPLET, specifying the top-level applet class file width, height –Used identically to WIDTH, HEIGHT in APPLET codebase –Used identically to CODEBASE attribute of APPLET align –Used identically to ALIGN in APPLET and IMG

Including Files and Applets15 Attributes of the jsp:plugin Element (Cont.) hspace, vspace –Used identically to HSPACE, VSPACE in APPLET, archive –Used identically to ARCHIVE attribute of APPLET, specifying a JAR file from which classes and images should be loaded name –Used identically to NAME attribute of APPLET, specifying a name to use for inter-applet communication or for identifying applet to scripting languages like JavaScript. title –Used identically to rarely used TITLE attribute

Including Files and Applets16 Attributes of the jsp:plugin Element (Cont.) jreversion –Identifies version of the Java Runtime Environment (JRE) that is required. Default is 1.1. iepluginurl –Designates a URL from which plug-in for Internet Explorer can be downloaded. Users who don’t already have the plug-in installed will be prompted to download it from this location. Default value will direct user to Sun site, but for intranet use you might want to direct user to a local copy. nspluginurl –Designates a URL from which plug-in for Netscape can be downloaded. Default value will direct user to Sun site, but for intranet use you might want local copy.

Including Files and Applets17 The jsp:param and jsp:params Elements PARAM Tags – Equivalent jsp:param –

Including Files and Applets18 The jsp:fallback Element APPLET Tag – Error: this example requires Java. Equivalent jsp:plugin with jsp:fallback – Error: this example requires Java.

Including Files and Applets19 Example Using Plugin... <jsp:plugin type="applet" code="coreservlets.ShadowedTextApplet.class" width="475" height="350"> <jsp:param name="MESSAGE" value="Your Message Here" />... See book and Web site for applet code

Including Files and Applets20 Example Using Plugin: Resultant HTML... <OBJECT classid=clsid:8AD9C E-11D1-B3E F499D93 width="370" height="420" codebase=" install-1_2_2-win.cab#Version=1,2,2,0"> <EMBED type="application/x-java-applet;" width="370" height="420" pluginspage=" >...

Including Files and Applets21 Example Using Plugin (Continued)

Including Files and Applets22 Example Using Plugin (Continued)

Including Files and Applets23 Summary –Output of URL inserted into JSP page at request time –Cannot contain JSP content that affects entire page –Changes to included file do not necessitate changes to pages that use it –File gets inserted into JSP page prior to page translation –Thus, file can contain JSP content that affects entire page (e.g., import statements, declarations) –Changes to included file require you to manually update pages that use it simplifies applets for plugin

Slides © Marty Hall, book © Sun Microsystems Press 24 Questions? Core Servlets & JSP book: More Servlets & JSP book: Servlet and JSP Training Courses: courses.coreservlets.com