1 of 6

ADVANCED JAVA PROGRAMMING

Introduction to JSP

Smt M.Jeevana sujitha

Assistant Professor

Department of Computer Science and Engineering

SRKR Engineering College, Bhimavaram, A.P. - 534204

2 of 6

OBJECTIVES

The Objectives of this lecture are

  • To learn about Introduction of JSP.
  • To learn about advantages of JSP over servlets.

3 of 6

Introduction to JSP

  • JSP stands for Java Server Pages.
  • JSP is a kind of scripting language in which we can embed java code

with HTML elements.

  • JSP is a simple webpage which contains the JSP elements and template

text.

  • The template text can be scripting code such as HTML,WML,XML or a simple plain text.
  • JSP elements can be action tags, custom tags or JSTL elements.
  • JSP elements are responsible for generating dynamic contents.

Example:

<html>

<body>

<%

out.println("JSP is better than Servlets");

%>

</body>

</html>

4 of 6

Advantages of JSP over Servlets

  • Both servlets and JSP are server side technologies used to generate dynamic webpages.
  • Designing dynamic webpages using servlets

require good knowledge of java. Where as using JSP creation of dynamic web pages is easy.

  • We need to recompile the servlet for every change in the source code. Where as

in JSP recompiling is not required, because JSP pages are automatically handled by the web container.

5 of 6

Advantages of JSP over Servlets

  • Servlets can not be accessed directly and have to map in the web.xml file. Where as in JSP, the JSP pages can be accessed directly like html pages.
  • There is no separation of presentation logic and business logic in servlets. Where as, in JSP there is a separation of business logic and presentation logic.

6 of 6

THANK YOU