WHY JSP?
Servlet follows Component architecture, follows request response model.
Servlet follows Component architecture, follows request response model.
- All the code goes inside service() / doGet () / doPost().
- This makes Servlet monolithic in nature.
- It is a tough job to write all the code in same method.
- Hence there emerged a need for a clear separation between CONTENT GENERATION & CONTENT REPRESENTATION.
- Using JSP Separation found was something like this.
Java Server Pages- JSP stands for Java Server Pages.
- JSP is a text document with any name which can contain 100% HTML tags & additional tags to embed java code.
- It is a java technology which allows software developer to dynamically generate HTML, XML or other types of document in response to Web client request.
- This document is stored in WEB-ROOT of a WEB-APPLICATION.
- Whenever the request comes for any jsp for the first time, JSP ENGINE (which) is part of Container translates .jsp into a .java file.
- Translated .java file is nothing but a 100% HttpServlet.
- Whenever any changes are made in .jsp file. JSP ENGINE retranslates & Recompile it.
- It is a java technology which allows software developer to dynamically generate HTML, XML or other types of document in response to Web client request.
- This document is stored in WEB-ROOT of a WEB-APPLICATION.
- Whenever the request comes for any jsp for the first time, JSP ENGINE (which) is part of Container translates .jsp into a .java file.
- Translated .java file is nothing but a 100% HttpServlet.
- Whenever any changes are made in .jsp file. JSP ENGINE retranslates & Recompile it.
ADVANTAGES OF JSP
1)WRITE ONCE, RUN ANYWHERE
- JSP technology is platform independent.
- JSP can be written on any platform, it can run from any platform & can
Be accessed from any web-browser on any platform.
- JSP technology is platform independent.
- JSP can be written on any platform, it can run from any platform & can
Be accessed from any web-browser on any platform.
2)HIGH QUALITY TOOL SUPPORT
- An explicit goal of Java Server Pages design is to enable the creation of high quality portable tools.
3)REUSE OF COMPONENTS & TAG LIBRARIES
- JSP uses reusable components such as
JAVA BEANS
ENTERPRISE JAVA BEANS
TAG LIBRARIES
- This save development time as well as gives cross-platform power & flexibility of Java programming.
4)SEPERATION OF DYNAMIC & STATIC CONTENT
- JSP enables separation of dynamic contents from static contents that is inserted in static template.
- This makes work easier & hence diminishes the dependency of WEB-DESIGNER over WEB-DEVELOPER & vice-versa.
5)SUPPORTS SCRIPTING & ACTIONS
- JSP supports scripting elements as well as actions.
- Action permits ENCAPSULATION.
- Scripting provides mechanism to glue-together functionalities.