What is JSP life cycle?
A JSP life cycle is defined as the process from its creation till the destruction.
This is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet..
Should I use JSP or servlet?
To choose between servlet an JSP I use a simple rule: if the page contains more html code than java code, go for JSP, otherwise just write a servlet. In general that translates roughly to: use JSPs for content presentation and servlets for control, validation, etc.
What is JSP and why do we need it?
JavaServer Pages (JSP) is a technology for developing Webpages that supports dynamic content. This helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with <% and end with %>.
What is difference between JSP and servlet?
Whereas, JSP is an HTML based code and JSP is simple to code as it is java in HTML. Servlets executes inside a Web server, such as Tomcat, While, A JSP program is compiled into a Java servlet before execution. Once it is compiled into a servlet, it’s life cycle will be similar as of servlet.
Why do we use servlets?
A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by web servers.
What are the disadvantages of JSP?
Disadvantages of JSPIt is hard to trace JSP pages error because JSP pages are translated to servlet.As JSP output is HTML, it is not rich in features.It is very hard to debug or trace errors because JSP pages are first translated into servlets before the compilation process.Database connectivity is not easy.More items…•