2. Learning Outcomes
• At the end of the lectures, student should be able to:
– Define JSP
– Compare between Servlets and JSP
– Explain JSP Scripting Elements
– Describe Java Beans and JSP
– Illustrate the process output generated by Servlets
process
– Integrate Servlets and JSP
3. Introduction
• JSP files are HTML files with special Tags containing
Java source code that provide the development of static
and dynamic web content.
• Goal: Create static and dynamic web content for a Web
Application
• Mostly HTML page, with extension .jsp
• JSP was developed by Sun Microsystems
7. Servers that support JSP
• Apache Tomcat
• GlassFish Server
• Allaire Jrun
• JRun
• GNU JSP
8. Why use JSP
• JSP is easy to learn and allows developers to quickly
produce web sites and applications in an open and
standard way.
• JSP is based on Java, an object-oriented language.
• JSP offers a robust platform for web development.
• Main reasons to use JSP:
- Multi platform
- Advantages of Java.
9. Comparison Between JSP and
Servlet
JSP SERVLET
JSP is Java inside HTML
Java codes are embedded inside an
HTML page
Servlet is HTML inside Java
HTML page is produced using
Java's out.println() in a Java program.
10. JSP Scripting Elements (JSP
Tags)
• There are 5 JSP tags
1.JSP Scriptlet
2.JSP Expression
3.JSP Directive
4.JSP Comment
5.JSP Declaration
11. Explanation of JSP Tags
Tag Name Function
<% %> JSP scriptlet Untuk memasukkan blok kenyataan Java
To insert a block of Java statements.
<%= %> JSP expression Pernyataan Java di mana outputnya di satukan
ke dalam HTML
Java expression whose output is spliced into
HTML
<%@ %> JSP directive Untuk menetapkan syarat yang digunakan untuk
keseluruhan JSP
To set conditions that applies to the entire JSP.
<%-- --%> JSP comment Untuk memberitahu enjin JSP untuk
mengabaikan kod
To tell the JSP engine to ignore code.
<%! %> JSP declaration Untuk mengisytiharkan pembolehubah dan
method bagi JSP
To declare variables and methods for a JSP
17. Describe Java Beans and JSP
• JavaBean is any class that
– Implements java.io.Serializable interface
– No-argument constructor
• Provide a few getter and setter method
• Never required for use with JSP
22. Summary
• JSP was developed by Sun Microsystems to allow
server side development.
• JSP files are HTML files with special Tags containing
Java source code that provide the dynamic content.
• There are 5 JSP tags
• JSP Scriplet
• JSP Expression
• JSP Directive
• JSP Comment
• JSP Declaration
Editor's Notes
Satu lagi tag JSP include directive &lt;%@ include file = “url” %&gt;