Introduction to JSP Tutorial

Introduction to JSP Tutorial

  • JSP (Java server pages) is API of J2EE which accept request and generate dynamic Response.
  • JSP technology is used to create dynamic web application.
  • With respect to functionality JSP and servlet are one or same because JSP get translated into servlet at Run time.
  • JSP Provide implicit objects, predefined tags, expression language which make your development easier.

Advantage of JSP

  • Easy to maintain.
  • If you change the JSP code then No need to re-compile and Re-deploy it again.
  • Very Less code compared to Servlet
  • JSP separate business logic and presentation logic.
    • Web designer can write presentation logic.
    • Web developer can write business logic to generate dynamic response.

Note: In case of JSP, you can write JAVA as well as HTML code.

How JSP works?

Whenever first request comes to JSP, it got translated into Servlets.

After compilation of Servlet it will translated to .class files.

This class file is used to generate dynamic response.

Difference between JSP and SERVLETS

JSP Tutorial

First JSP Application

Read Here Creating your first JSP application in Eclipse

[pastacode lang=”java” manual=”%3C%25%40%20page%20language%3D%22java%22%20contentType%3D%22text%2Fhtml%3B%20charset%3DISO-8859-1%22%20pageEncoding%3D%22ISO-8859-1%22%25%3E%0A%0A%3Chtml%3E%0A%0A%3Chead%3E%0A%0A%3Cmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DISO-8859-1%22%3E%0A%0A%3Ctitle%3EInsert%20title%20here%3C%2Ftitle%3E%0A%0A%3C%2Fhead%3E%0A%0A%3Cbody%3E%0A%0A%3Ch1%3EThis%20is%20JSP%20page%3C%2Fh1%3E%0A%0A%3Cp%3E%20Javaforlearn%20is%20a%20platform%20where%20newbie%20programmer%20find%20a%20way%20to%20learn%20different%20Technology%20like%20java%2C%20J2EE%2C%20SQL%2C%20ODI%20%2C%20OBIEE%20and%20data%20warehouse%20concept.%3C%2Fp%3E%0A%0A%3C%25%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%2F%2Fhere%20you%20can%20write%20java%20code.%0A%0ASystem.out.println(%22Hi%20Application%20is%20running%20%22)%3B%20%20%C2%A0%2F%2FPrinting%20simple%20message%20in%20console%0A%0Aout.println(%22Hi%20This%20is%20Bhavesh%20Lakhani%22)%3B%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%20%C2%A0%2F%2FPrinting%20simple%20message%20in%20Browser%0A%0A%25%3E%0A%0A%3C%2Fbody%3E%0A%0A%3C%2Fhtml%3E” message=”index.jsp” highlight=”” provider=”manual”/]

Output:

JSP Tutorial

Console Output:

console-output

Leave a Reply