JavaServer Pages (JSP) is a technology which is used by the software developers to create dynamic web pages based on HTML, XML, or other document types. JSP released in 1999 by Sun Microsystems, JSP is similar to PHP, ASP and React’s JSX, but it uses the Java programming language.
What is JSP?
Java Server Pages (JSP) is a server-side programming language that is used for the creation of dynamic, platform-independent method for building Web-based applications. JSP have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.
JSP technology is used to create web application java course in bangalore just like Servlet technology. It can be thought of as an extension to servlet because it provides more functionality than servlet such as expression language, jstl etc.
A JSP page consists of HTML tags and JSP tags. The jsp pages are easier to maintain than servlet because we can separate designing and development. It provides some additional features such as Expression Language, Custom Tag etc.
Advantage of JSP over Servlet
There are many advantages of JSP over servlet. They are as follows:
1) Extension to Servlet : JSP technology is the extension to servlet technology . We can use all the features of servlet in JSP. Java training center bangalore In addition to, we can use implicit objects, predefined tags, expression language and Custom tags in JSP, that makes JSP development easy.
2) Easy to maintain : JSP can be easily managed because we can easily separate our business logic with presentation logic. In servlet technology, we mix our business logic with the presentation logic.
3) Fast Development: No need to recompile and redeploy
If JSP page is modified, we don’t need to recompile and redeploy the project. The servlet code needs to be updated and recompiled if we have to change the look and feel of the application.
4) Less code than Servlet:
In JSP, we can use a lot of tags such as action tags, advanced java training in bangalore jstl, custom tags etc. that reduces the code. Moreover, we can use EL, implicit objects etc.
Life cycle of a JSP Page
The JSP pages follows these phases:
Translation of JSP Page
Compilation of JSP Page
Classloading (class file is loaded by the classloader)
Instantiation (Object of the Generated Servlet is created).
Initialization ( jspInit() method is invoked by the container).
Request processing ( jspService() method is invoked by the container).
Destroy ( jspDestroy() method is invoked by the container).
The JSP API
The JSP API consists of two packages:
The JspPage interface
According to the JSP specification, all the generated servlet classes must implement the JspPage interface. Java /j2ee classes bangalore It extends the Servlet interface. It provides two life cycle methods.
Methods of JspPage interface :
1. public void jspInit() : It is invoked only once during the life cycle of the JSP when JSP page is requested firstly. It is used to perform initialization. It is same as the init() method of Servlet interface.
2. public void jspDestroy(): It is invoked only once during the life cycle of the JSP before the JSP page is destroyed. It can be used to perform some clean up operation.
JSP Standard Tag Library:
JSTL is a standard tag library of the JSP.
What is JSTL?
JSTL stands for Java server pages standard tag library, best core java training in bangalore and it is a collection of custom JSP tag libraries that provide common web development functionality.
JSP Custom Tags
It is a user-defined JSP language element.
When JSP is translated into a servlet, custom tag is converted into a class which takes
action on an object and is called as a tag handler.
Those actions when the servlet is executed are invoked by the web container.
To create the user-defined custom tag, we need to create the tag handler which will be extending the SimpleTagSupport and have to override doTag() method.
We need to create TLD where we need to map the class file in TLD.
best java training institute bangalore Marathahalli
Advantages of custom tags in JSP:
Portable – An action described in a tag library must be usable in any JSP container.
Simple – Unsophisticated users must be able to understand and use this mechanism.
Expressive – The mechanism must support a wide range of actions, including nested actions, scripting elements inside action bodies, creation, use and updating of scripting variables.
Usable from different scripting languages – Although the JSP specification currently only defines the semantics for scripts in the Java programming language, we want to leave open the possibility of other scripting languages. core and advanced java institute in marathahalli
Built upon existing concepts and machinery- We do not want to reinvent what exists elsewhere. Also, we want to avoid future conflicts whenever we can predict them
This is the short description about the JSP . To get the good knowledge on Core and Advanced Java for getting a job as java developer and to make a bright career join Infocampus Software Training Institute for java course.
Author : Infocampus is one of the best training institute for java course in bangalore.
It provides 4 days free demo classes for java training. Training on java/j2ee classes provided by the more than 10 years experienced trainers. Syllabus for best core java training is according to getting a job easily.Classes on Advanced java training is available on flexible timing on weekdays and weekends.
To book the seat for free demo class call at : 9738001024 or to know about the syllabus and course enquire at : http://www.infocampus.co.in/java-training-bangalore.html