what is the difference between Servlet and JSP?Advantage of
JSP over Servelt?Any concept present in JSP which we cant
implement in Servlet?
Answer Posted / farhaananwar
JSP is the extension of HttpServlet instance. JSP is
basically used for presentation and servlet is used for
bussiness logic although you use servlet for presentation
after all JSP page also boil down to jsp servlet but
presentation with servlet is realy labours and boring.
Servlet are free from Http protocol you can use
GenericServlet class as base class of your custom servlet
class to perform communication with client either in http
protocal and others but with JSP page your are married only
to HTTP protocol. JSP page provides you with set of implicit
objects that are page, request, response, session,
pageContext, config, out, application, exception (only for
error page) whereas you do not find them in servlet at your
disposal. With help of servlet you can not only use jstl
tags but also design your own custom tags which can be
classic tags, simple tag and tag file. this help you to keep
away java code from JSP page presentaion. tags are like
function call where rest of bussiness logic kept away from
main flow program this helps to keep thing unclutterd and
encouraged reusablity. use of bean with standard action and
tags are easier than the use of bean in servlet.
EL expression, EL function, tags are some new concepts
that can not be used in servlet as it is but need some hard-
coding in java lang to achieve the same.
| Is This Answer Correct ? | 92 Yes | 26 No |
Post New Answer View All Answers
What are its drawbacks of cgi?
What is Servlets and explain the advantages of Servlet life cycle?
What are the phases of a servlet life cycle?
How does Cookies work in Servlets?
Is tomcat a servlet container?
What is the difference between the include() and forward() methods?
Can servlet have a constructor ?
Can you explain in detail 'javax.servlet' package?
I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?
What is the procedure of invoking different servlet in a different application?
I have a requirement Here we have a ResultSet object that will contain 50 records i need to print those recors in to a webpage(i.e; view according to MVC architectures that mybe servlet or jsp) . Here i need to print the records 10 per page that is 1 to 10 in page one and 11 to 20 in page two like remaining will be appeared in other pages we need to display those page numbers whenever we click on that page number we will go to that page and display 10 records like we will display 5 pages it is like this << 1 2 3 4 5 next >>
What do you mean by httpservlet?
Why do you use session tracking in httpservlet?
What are the types of servlets? Explain
What's the difference between authentication and authorization?