JavaServer Pages (JSP) is a technology that helps software developers create dynamically generated web pages based on HTML, XML, or other document types. Released in 1999 by Sun Microsystems, JSP is similar to PHP and ASP, but it uses the Java programming language.
To deploy and run JavaServer Pages, a compatible web server with a servlet container, such as Apache Tomcat or Jetty, is required.
Architecturally, JSP may be viewed as a high-level abstraction of Java servlets. JSPs are translated into servlets at runtime, therefore JSP is a Servlet; each JSP servlet is cached and re-used until the original JSP is modified.
JSP can be used independently or as the view component of a server-side model–view–controller design, normally with JavaBeans as the model and Java servlets (or a framework such as Apache Struts) as the controller. This is a type of Model 2 architecture.
JSP allows Java code and certain predefined actions to be interleaved with static web markup content, such as HTML, with the resulting page being compiled and executed on the server to deliver a document. The compiled pages, as well as any dependent Java libraries, contain Java bytecode rather than machine code. Like any other Java program, they must be executed within a Java virtual machine (JVM) that interacts with the server’s host operating system to provide an abstract, platform-neutral environment.
JSPs are usually used to deliver HTML and XML documents, but through the use of OutputStream, they can deliver other types of data as well.
The Web container creates JSP implicit objects like request, response, session, application, config, page, pageContext, out and exception. JSP Engine creates these objects during translation phase.
If you wish to build up your JSP knowledge first, check out our JSP Tutorial – The ULTIMATE Guide.
JSP Tutorials – Getting Started
Simple examples based on the JavaServer Pages
- JSP Tutorial For Beginners
In this tutorial, we will look into the essentials of the JSP technology with illustrating some simple code.
- JSP Expression Language Tutorial
In this section, developers learned how to create and use the JSP Expression Language (EL) through a simple application
- JSP Scriptlet Example
In this post, we will demonstrate how to use scriptlets in a web application example.
- JSP Custom Tags Example
In this example, we are going to show you how to create and use JSP custom tags.
- JSP Implicit Objects Example
In this example we are going to explain what are the implicit objects in a jsp page and what is their functionality, as well as show some examples of their usage.
- Eclipse JSP Editor Example
In this example, we will learn to use the JSP Editor available through the Web Tools Platform (WTP) within Eclipse.
- Conditional content in JSP page
In this example we are going to see how to create a conditional content in a JSP page.
- Create an error page for JSP pages
This is an example of how to create an error page in JSP pages.
- Comments in JSP Page
In this example we shall show you how to add comments in a JSP page.
- Use Bean in JSP Page
In this example we are going to demonstrate how to use a Bean in a JSP page.
- Pass Parameters to other JSP Page
This is an example of how to pass parameters from one JSP page to another.
- Include file in JSP page
In this example we shall show you how to include a file in a JSP page.
- Get Request Parameter in JSP page
In this example we are going to demonstrate how to get Request Parameters in a JSP page.
- Send Redirect in JSP page
This is an example of how to send Redirect in a JSP page.
- Get Request Header in JSP page
In this example we shall show you how to get the Request Header in a JSP page.
- Use Java Code in JSP page
In this example we are going to demonstrate how to use Java code in a JSP page.
- Sample JSP Java Server Page
This is an example of how to create a sample JSP page.
- JSP Directives Example
In this post, we will look into the details of the JSP directives and examine them on some code snippets.
JSP Tutorials with JSTL
Learn to use JSTL in JSP
- Set scoped variables with JSTL in JSP Page
In this example we shall show you how to set scoped variables in a JSP Page, using JSTL.
- Get Request Parameter with JSTL in JSP Page
In this example we are going to demonstrate how to get Request Parameter with JSTL in a JSP page.
- Conditional content with JSTL in JSP page
This is an example of how to create conditional content in a JSP page using JSTL.
- Use JSTL in JSP Page
In this example we shall show you how to use JSTL in a JSP page.
JSP Tutorials – Integrations
Learn how to use JSP with the most powerful 3rd party frameworks and servlets.
- MongoDB and JSP/Servlet Example
In this tutorial, we will learn how to connect the Servlet with the Mongo database.
- Java Servlet and JSP Example
In this article we will demonstrate a simple Servlet and JSP example using the maven cargo plugin from the command line.
- Struts JSP Example
In this example, we will show developers how to create a simple Hello World example in Struts2.
- Jetty JSP Example
In this example, we are going to enable Jetty for JSP.
- Jetty “JSP Support not Configured” Error
In this example, we will show how to resolve an error which is frequently encountered if you are using Java Server Pages (JSP).