Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. JSP have access to the entire family of Java APIs, including the JDBC API to access enterprise databases. This tutorial will teach you how to use Java Server Pages to develop your web applications in simple and easy steps.
JSP is essentially a server-side scripting language that helps you to create dynamic, platform-independent method for building applications based on web. One of the original Java web technologies, JavaServer Pages is widely used to build dynamic web pages that connect to the Java backend. JSP is a Java standard technology that enables you to write dynamic, data-driven pages for your Java web applications.
JSP is built on top of the Java Servlet specification. The two technologies typically work together, especially in older Java web applications. From a coding perspective, the most obvious difference between them is that with servlets you write Java code and then embed client-side markup (like HTML) into that code, whereas with JSP you start with the client-side script or markup, then embed JSP tags to connect your page to the Java backend. JavaServer Pages (JSP) technology allows you to easily create web content that has both static and dynamic components. JSP technology makes available all the dynamic capabilities of Java Servlet technology but provides a more natural approach to creating static content. By using JSP, you can take input from users through forms present on web page, display records from a database or another source, and can move dynamically from one page to another JSP page present in same file or other file.
Since Java Server Pages are built on top of the Java Servlets API, so like Servlets, JSP also has access to all the powerful Enterprise Java APIs, including JDBC, JNDI, EJB, JAXP, etc. JSP pages can be used in combination with servlets that handle the business logic, the model supported by Java servlet template engines. JSP is a complimentary technology to Java Servlet which facilitates the mixing of dynamic and static web contents. JSP is Java's answer to the popular Microsoft's Active Server Pages (ASP). JSP, like ASP, provides a elegant way to mix static and dynamic contents. The main page is written in regular HTML, while special tags are provided to insert pieces of Java programming codes. The business programming logic and the presentation are cleanly separated. This allows the programmers to focus on the business logic, while the web designer to concentrate on the presentation.
A JSP page is a text document that contains two types of text: static data, which can be expressed in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which construct dynamic content. JSP helps developers to insert java code in HTML pages by using special JSP tags, most of which start with <% tag and ends with %> tag. Developers of programmers write JSP as a normal text file and then attach this JSP code with any other file like html, xml, etc. The recommended file extension for the source file of a JSP page is .jsp. The page can be composed of a top file that includes other files that contain either a complete JSP page or a fragment of a JSP page. The recommended extension for the source file of a fragment of a JSP page is .jspf.
The JSP elements in a JSP page can be expressed in two syntaxes, standard and XML, though any given file can use only one syntax. A JSP page in XML syntax is an XML document and can be manipulated by tools and APIs for XML documents. This chapter and Chapters Chapter 7, JavaServer Pages Standard Tag Library through Chapter 9, Scripting in JSP Pages document only the standard syntax. The XML syntax is covered in Chapter 6, JavaServer Pages Documents.
Finally, JSP is an integral part of Java EE, a complete platform for enterprise class applications. This means that JSP can play a part in the simplest applications to the most complex and demanding.
Uplatz provides this in-depth training on Java Server Pages (JSP) to help you master the most widely used technology for developing web applications.
This practical, application-oriented Java JSP training course teaches Java Servlets, JDBC and JSP and shows how to use it to develop simple to complex database-driven Web applications. It is intended for experienced Java (J2SE) programmers who want to build Web applications or J2EE components and systems.
This JavaEE JSP training course for web developers & programmers will show you how to build end to end Web applications using JEE best practices, design patterns, and technologies to ensure that you get a performant, scalable JEE/JSP applications. JSP training develops skills to create web pages that display dynamically-generated content.
Features of JSP
A language for developing JSP pages, which are text-based documents that describe how to process a request and construct a response
An expression language for accessing server-side objects
Mechanisms for defining extensions to the JSP language
JSP technology also contains an API that is used by developers of web containers
Advantages of JSP
Using Javaserver Pages is very simple and like other Java based programs a candidate can learn JSP without having any in depth knowledge or Java related training. Also it can even be implemented by non- Java programmers.
Javaserver Pages allows developers to make presentation codes, since the webpages are compiled dynamically into servers.
JSP allows web developers to change a specific portion in the template of a page, without affecting the entire application logic.
JSP is a portable platform, which means the technology can be used in other web servers and operating system.
Javaserver Pages provided implicit exception handling mechanism and compiles pages automatically.
Separation of static and dynamic contents: The dynamic contents are generated via programming logic and inserted into the static template. This greatly simplifies the creation and maintenance of web contents.
Reuse of components and tag libraries: The dynamic contents can be provided by re-usable components such as JavaBean, Enterprise JavaBean (EJB) and tag libraries - you do not have to re-inventing the wheels.
Java's power and portability.
JSP (Java Server Pages) - course syllabus
Introduction to Web
Introduction to JSP
Scripting Elements - part 1
Scripting Elements - part 2
Scripting Elements - part 3
Implicit Object Request
Implicit Project - part 1
Implicit Project - part 2
Implicit Project (Login) - part 3
Implicit Project (Reg) - part 4
Implicit Project - part 5
Implicit Project (Output) - part 6
Directives Page - part 1
Directive Page - part 2
Directive Include - part 1
Directive Include - part 2
JSP Action Tag - Usebean - part 1
JSP Action Tag - Usebean - part 2
JSP Action Tag - Usebean - part 3
JSP - Include Action Tag - part 1
JSP - Include Action - part 2
JSP - Forward Action - part 1
JSP - Forward Action - part 2
Expression Language - part 1
Expression Language (Param) - part 2
Expression Language - part 3
Expression Language (RequestScope) - part 4
Java Bean using Expression Language - part 1
Java Bean using Expression Language - part 2
Java Bean using Expression Language - part 3
JSTL Core - part 1
JSTL Core - part 2
JSTL Core (URL) - part 3
JSTL SQL - part 1
JSTL SQL (Update) - part 2
JSTL SQL Update - part 3
JSTL - Function - part 1
JSTL - Function - part 2
JSTL - Function - part 3
MVC in JSP - part 1
MVC in JSP - part 2
Detailed-level list of topics covered
1. Web Applications
2. Servlets Architecture
Servlet and HttpServlet
Request and Response
Reading Request Parameters
Producing an HTML Response
Redirecting the Web Server
Servlets Life Cycle
Relationship to the Container
3. Interactive Web Applications
4. Session Management
Managing Client State
5. Configuration and Context
The Need for Configuration
JNDI and the Component Environment
JDBC Data Sources
Working with XML Data
7. Database and SQL Fundamentals
Relational Databases and SQL
SQL Versions and Code Portability
Database, Schema, Tables, Columns and Rows
DDL - Creating and Managing Database Objects
DML - Retrieving and Managing Data
Result Sets and Cursors
Using SQL Terminals
8. JDBC Fundamentals
What is the JDBC API?
Making a Connection
Creating and Executing a Statement
Retrieving Values from a ResultSet
SQL and Java Datatypes
SQL NULL Versus Java null
Creating and Updating Tables
Handling SQL Exceptions and Proper Cleanup
9. Advanced JDBC
SQL Escape Syntax
Using Prepared Statements
Using Callable Statements
Scrollable Result Sets
Updatable Result Sets
Commits, Rollbacks, and Savepoints
Alternatives to JDBC
10. Introduction to Row Sets
11. JSP Architecture
Types of JSP Content
Custom Actions and JSTL
Objects and Scopes
12. Scripting Elements
13. Interactive JSP Applications
Reading CGI Parameters
JSPs and Java Classes
The Session API
Cookies and JSP
14. Using JavaBeans
Separating Presentation and Business Logic
Working with Properties
<jsp:getProperty> and <jsp:setProperty>
Using Form Parameters with Beans
Objects and Scopes
Working with Vectors
15. The Expression Language and the JSTL
16. Advanced JSP Features
17. JSP for Web Services
JSP Training Learning Objectives
Explain the fundamentals of HTML and HTTP in the World Wide Web.
Describe JavaServer Pages and their relationship to servlets and J2EE generally.
Describe how a JSP is translated into a servlet and processed at runtime.
Explain the use of directives on JSPs and outline the principal directives.
Implement simple JSPs that use Java code in declarations, expressions and scriptlets.
Enumerate and use the implicit objects available to scripting elements.
Implement an interactive Web application using HTML forms and JSP.
Use Java exception handling and JSP error pages to handle errors in JSP applications.
Implement session management for a JSP application.
Manage cookies to store client-specific information at various scopes and durations.
Use JavaBeans to implement effective interactive JSP applications.
Describe custom tags in JSP and explain how they are implemented, both using Java and JSP itself, and how they are used.
Discuss threading issues in JSP and describe the use of directives to control how threading is handled.
Describe the various uses of XML in JSP applications.
Deploy a logical Web application to a Web server in a WAR file.
Describe the use of the JSP expression language to simplify dynamic page output.
Write JSP expressions and implement JSPs that use them in favor of scripts.
Implement JSPs that use basic JSTL actions to simplify presentation logic.
Decompose a JSP application design into fine-grained, reusable elements including JavaBeans, custom tag handlers and tag files that use JSTL.
Use core JSTL actions to complement standard actions, custom actions, and
JSP expressions for seamless, script-free page logic.
Direct conditional and iterative processing of page content by looping through ranges of numbers, over elements in a collection, or over tokens in a master string.
Set locale and time zone information in JSPs, and use them to correctly format numbers, dates and times for all clients.
Use resource bundles to manage application strings, and produce the appropriate strings at runtime for a particular client locale.
Locate a data source, query for relational data, and parse result sets.
Perform updates, inserts and deletes on relational data using SQL actions.
Manage queries and updates in transaction contexts.
Derive information from parsed XML content using XPath expressions.
Implement conditional processing and loops based on XML information.
Apply XSLT transformations to XML content.
Implement a simple Web service that reads and writes SOAP.
Understand and appreciate the role of Java Servlets in the overall Java 2 Enterprise Edition architecture, and as the best Java solution to HTTP application development.
Use request and response objects provided to a servlet to read CGI parameters and to produce an HTML response.
Develop interactive Web applications using HTML forms and servlets.
Manage complex conversations with HTTP clients using session attributes.
Understand the role of JDBC in Java persistence code, and use JDBC for persistence in servlet applications.
Preserve portability and ease of administration for a servlet application by parameterizing servlet code, using initialization parameters, properties files, and JNDI.
Use JavaBeans classes to share complex business data between components.
Implement filters to adapt existing servlets with new features, and to maximize the decomposition of logic between vertical business functions and horizontal facilities.
Comparison of JSP vs. similar technologies or concepts
JSP vs. Active Server Pages (ASP)
The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.
JSP vs. Pure Servlets
JSP vs. Server-Side Includes (SSI)
SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like.
JSP vs. Static HTML