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.

Slides:



Advertisements
Similar presentations
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Advertisements

Java Server Pages (JSP)
Java Server Pages Jeffrey Jongko. Introduction Java Server Pages (JSP) technology was created by Sun Microsystems and is built on top of Sun’s Java Servlet.
 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.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
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 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
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.
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.
1 JSP – Java Server Pages Representation and Management of Data on the Internet.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
What Are Beans? beans are simply Java classes that are written in a standard format. A bean class must have a zero-argument (default) constructor. A bean.
JSP Java Server Pages Softsmith Infotech.
Introduction to Java Server Pages (JSPs) Robert Thornton.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
Jordan Anastasiade. All rights reserved.
Stanisław Osiński, 2002JSP – A technology for serving dynamic web content Java Server Pages™ A technology for serving dynamic web content Stanisław Osiński,
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Slides © Marty Hall, book © Sun Microsystems Press 1 JSP Scripting Elements Core Servlets & JSP book:
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
Writing Enterprise Applications with J2EE (Fourth lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
JSP Fundamentals Elements of a JSP Using Beans with JSP Integrating Servlets and JSP.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaServer Page.
CSC 2720 Building Web Applications JavaServer Pages (JSP) The Basics.
1 JSP – Java Server Page DBI – Representation and Management of Data on the Internet.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Java Server Pages (JSP)
Java Server Pages An introduction to JSP. Containers and Components Several clients – one system.
3/6/00jsp00 1 Java Server Pages Nancy McCracken Northeast Parallel Architectures Center at Syracuse University.
Java Server Pages Introduction. Servlet Drawbacks Web page designer will need to know servlets to design the page. Servlet will have to be compiled for.
Chapter 11 Invoking Java Code with JSP Scripting Elements.
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.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
JSP – Java Server Page DBI – Representation and Management of Data on the Internet.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
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.
1 Chapter 27 JavaServer Page. 2 Objectives F To know what is a JSP page is processed (§27.2). F To comprehend how a JSP page is processed (§27.3). F To.
INVOKING JAVA CODE WITH JSP SCRIPTING ELEMENTS. Creating Template Text A large percentage of your JSP document consists of static text (usually HTML),
JAVA SERVER PAGES -by Rubeena Memon Deepti Jain Jaya Thakar Jisha Vettuventra.
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.
JSP Action Elements Lec - 37.
Developing JavaServer Pages
Java Server Pages (JSP)
Java Server Pages.
Java Server Pages By: Tejashri Udavant..
COMP9321 Web Application Engineering Semester 2, 2017
Scripted Page Web App Development (Java Server Pages)
Including Files and Applets in JSP Pages
Pre-assessment Questions
Introduction to JSP Java Server Pages
JSP(Java Server Pages)
Invoking Java Code from JSP
Java Server Pages (JSP)
Java Server Pages JSP 11/11/2018.
JSP Syntax.
Java Server Pages B.Ramamurthy.
JSP Directives 1-Jan-19.
JSP implicit objects & directive elements
Scripted Page Web Application Development (Java Server Pages)
Web Technologies Java Beans & JSP
Presentation transcript:

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 to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA JSP (Java Server Pages) is server side technology to create dynamic java web application. JSP can be thought as an extension to servlet technology because it provides features to easily create user views. JSP Page consists of HTML code and provide option to include java code for dynamic content. Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA Since web applications contain a lot of user screens, JSPs are used a lot in web applications. To bridge the gap between java code and HTML in JSP, it provides additional features such as JSP Tags, Expression Language, Custom tags. This makes it easy to understand and helps a web developer to quickly develop JSP pages. Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA JSP Declaration Tag The JSP declaration tag is used to declare fields and methods. <html> <body> <%! int data=50; %> <%= "Value of the variable is:"+data %> </body> </html> Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA JSP Scriptlet tag In JSP, java code can be written inside the jsp page using the scriptlet tag.  <html> <body> <% out.print("welcome to jsp"); %> </body> </html> JSP expression tag The code placed within JSP expression tag is written to the output stream of the response. <html> <body> <%= "welcome to jsp" %> </body> </html> Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA Page Directive There are several attributes, which are used along with Page Directives and these are import session isErrorPage errorPage ContentType isThreadSafe extends info language autoflush Buffer Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA <%@page import="java.io.*%> <%@page import="java.lang.*%> <%--Comment: OR Below Statement: Both are Same--%> <%@page import="java.io.*, java.lang.*"%> Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA <%@ page errorPage="ExceptionHandling.jsp"%> This means if any exception occurs on the JSP page where this code has been placed, the ExceptionHandling.jsp (this page should have isErrorPage true) page needs to be called. Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA JSP implicit object Implicit Object Description request The HttpServletRequest object associated with the request. response The HttpServletRequest object associated with the response that is sent back to the browser. out The JspWriter object associated with the output stream of the response. session The HttpSession object associated with the session for the given user of request. application The ServletContext object for the web application. config The ServletConfig object associated with the servlet for current JSP page. pageContext The PageContext object that encapsulates the enviroment of a single request for this current JSP page page The page variable is equivalent to this variable of Java programming language. exception The exception object represents the Throwable object that was thrown by some other JSP page. Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA JSP Action JSP actions use the construct in XML syntax to control the behavior of the servlet engine. can dynamically insert a file, reuse the beans components, forward user to another page, etc. through JSP Actions like include and forward. Unlike directives, actions are re-evaluated each time the page is accessed. Syntax: <jsp:action_name attribute="value" /> Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA There are 11 types of action names as following: jsp:useBean jsp:include jsp:setProperty jsp:getProperty jsp:forward jsp:plugin jsp:attribute jsp:body jsp:text jsp:param jsp:output Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA Action Tag Description jsp:forward forward the request to a new page Usage : <jsp:forward page="Relative URL" /> jsp:useBean instantiates a JavaBean Usage : <jsp:useBean id="beanId" /> jsp:getProperty retrieves a property from a JavaBean instance. Usage : <jsp:useBean id="beanId" ... /> ... <jsp:getProperty name="beanId" property="someProperty" .../> Where, beanName is the name of pre-defined bean whose property we want to access. Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA jsp:setProperty store data in property of any JavaBeans instance. Usage : <jsp:useBean id="beanId" ... /> ... <jsp:setProperty name="beanId" property="someProperty" value="some value"/> Where, beanName is the name of pre-defined bean whose property we want to access. jsp:include includes the runtime response of a JSP page into the current page. jsp:plugin Generates client browser-specific construct that makes an OBJECT or EMBED tag for the Java Applets Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA jsp:fallback Supplies alternate text if java plugin is unavailable on the client. You can print a message using this, if the included jsp plugin is not loaded. jsp:element Defines XML elements dynamically jsp:attribute defines dynamically defined XML element's attribute jsp:body Used within standard or custom tags to supply the tag body. jsp:param Adds parameters to the request object. jsp:text Used to write template text in JSP pages and documents. Usage : <jsp:text>Template data</jsp:text> Introduction to JSP : Dept. of B.Voc SD&SA

Introduction to JSP : Dept. of B.Voc SD&SA welcome.jsp <html> <head> <title>Welcome Page</title> </head> <body> <%@ include file="header.jsp" %> Welcome, User </body> </html> header.jsp <img src="header.jpg" alt="This is Header image" / > Introduction to JSP : Dept. of B.Voc SD&SA