JSP Intro and Overview
- Looking at JSP in the real
When servlet has come in the market that time CGI was prevalent.
But as people started using the servlet they found very comfortable.
It makes web programming easy.It has no complicated syntax as that of
the CGI technology.
It also eliminates the server problem prsesnt in CGI technology.
In Servlet programer has to make the class and to add the entries about
its description in the web.xml.
in jsp programer doesnot need to add the values tothe web.xml.
It consists of html page along with simple Jsp structure.
- It is a servlet technology.
- It is simple than servlet
- User need not to create any class file.
- It allows to use static html/css with dynamic Servlet
- Internally it gets converted into the servlet by the
It has following structures.
- Simple html file
- Css can be used.
Jsp elements present are
These elements are embedded into jsp page in the html file.
These gets invoked while processing of the Jsp page.
- Create a directory JspTest
- Change the directory to JspTest
- In the JspTest directory create WEB-INF directory
- Create a file called Hello.jsp
- Inside WEB-INF create one file Hello.jsp
Directory structure is like this.
<h1>Hello jsp world</h1>
Today date and time is
- jsp file can be deployed to any of the web server.
- Create the war file for it and deploy it on the given
c:\JspTest>copy test.war . c:\apache-tomcat-6.0.20\webapps
Running the test.war
- Above step creates a file called test.war
- This file contains jsp file along with WEB-INF, web.xml
- In tomcat server webapps contains the all web
- After copying test.war it gets deployed it there.
- A test folder gets created containing all the required
- Open the browser.
- Give the url http://localhost:8080/test/Hello.jsp
- The jsp program will start running here.
- Client request the jsp file using the browser.
- Jsp Engine starts jsp engine over that file
- Jsp translator converts the jsp file into servlet source
- The Servlet source file is compiled into Servlet class file
by the Jsp Engine.
- Servlet class file is run by the Servlet Engine
- The output is transferred to the browser by the Web Server
of jsp over Servlet
- As html css is easily embedded so used for the presesntation
- It requires less XML values to the web.xml
- It has easy syntax similar to xml
- It is extensible with Javabeans and Custom Tags