Learning JSP (Part 1) – Introduction
- Feb 05, 2012
Hello everyone! We are starting a new series for exploring well popular server side technology called ‘JSP’ (Java Server Pages). We will focus on learning this technology from very basic.
Today we will be covering following topics:
- What is JSP?
- How does it looks like?
- Where can we use it?
- Things required to get started.
1. What is JSP?
JSP is a server side technology like ASP and PHP. This technology allows us to use Java code with static markup language. It is useful for development of web based application independent of server and platform. JSP page is compiled and executed on the server and the resulting HTML or XML page is delivered to the client side. The compiled pages on server uses Java bytecode and this bytecode can be executed by Java Virtual Machine (JVM).
Java bytecode – It is a form of instruction that Java Virtual Machines executes. Having knowledge of java bytecode is same as having knowledge of assembler for C or C++ programmer.
2. How does it look like?
The use of jsp is same as that of php. We can use jsp tags along with the regular HTML tags. See the following example for getting clear idea.
<title>JSP Demo Page</title>
<% out.println("This Line is in JSP tag."); %>
As you can see, I have used jsp tag along with html tags. We can use jsp tags wherever we want to show the dynamically generated content.
3. Where can we use it?
JSP can be used anywhere where dynamic nature is required for your application or website. If you want to show data from database, jsp is the best choice. It is secured technology since every jsp page is compiled into the bytecode on the server and no human being can read it. You can separate design view and business logic of your application to make it more defensive. As jsp requires JVM for execution and JVM is available for all platforms so it becomes platform independent too. It can be used for creating Web Sites, Web Services, Online Shops, Content Management Systems and much more.
4. Things required to get started!
For getting started with jsp you will require following tools/application.
a. Java Runtime Environment (JRE) depending upon your OS.
b. Apache Tomcat Server
c. Any text editing software you love.
For today, this will be enough. In next post we will setup environment for running jsp and write first jsp page.
If you like this article and want to continue learning more about jsp then please give your feedback and comments.