What is the difference between servlets and jsp?
In servlet,java will be used to generate dynamic HTML pages,but in JSP,java will be reduced and we can use our custom tags to generate HTML pages.
Posted by: olymohamed
In servlet if any change in your class file you must redeploy again but jsp only one you have to deploy. in compare to servlet jsp reduce code and contains implicit objects.
Posted by: chitra
What is the difference between servlets and Java Server Pages? Which is preferred?
Posted by: hariharan
(1)Bits of HTML embedded in java code.(2) Suitable for coding business layer of enterprise application.(3)Created and maintained by Java programmers
(1) Bits of java code embedded in HTML.
(2)Suitable for coding presentation layer of enterprise application
(3)Created and maintained by Web designers.
Posted by: Margi Pancholi
Contact Margi Pancholi
JSP page has both presentation logic and business logic but servlet has only business logic and presentation logic is present in html file
Posted by: sai
Jsp is nothing but a servlet.jsp is transfered to servlet by jsp engine.after converting it acts like a servlet.in servlets static content and dynamic content are combined.we can avoid this using jsp.we can separate static content from dynamic content.so this makes the application very flexible.
Posted by: ranjith
Posted by: ranjith
In jsp html pages with javacode embedded inside of them.In servlets java programs with html embedded inside of them.
Posted by: priya.s
In servlet java code can't embedded wih servlet's custome tag.
In jsp java code can embedded with jsp's custome tag
Posted by: Baskar
JSP contains more static content and less dynamic content but servlet contains more dynamic and less static content.
Posted by: muthu
Servlet contains very indepth coding to develop any servlet web application.And also all logics are implemented in same servlets we get page centric problem.There is no implicits objects and by default servlet is not a threadsafe.It is not participating session by default.javax.servlet package.
when compare to servlets....
In jsp,Indepth java coding is reduced because of custom tags is used.And Business,Data acess logics are developed in different webpages.It means presentation logics are developed in jsp page and data acess logic developed in JavaBean class.It eliminates pagecentric problem. Jsp have its own implicit objects provided by container.Bydefault its participating in session.It is the subpackage of javax.servlet.jsp package.But both are available in same server.
Posted by: venkateswara reddy gunapati
Contact venkateswara reddy gunapati
servlet:-1)mainly for business logic.
2)once compled a servlet,if any modifications then once again complie and re-deploy.
3)no implicit objects.
jsp:-1)mainly for presentation logic.
2)want to make changes go to the source jsp file and make changes,not need any recompilation.
3)implicit objects are there.
**** jsp== servlet ****
because,even if u write any jsp file at the back a servlet will be generated.
(for example if u r using tomcat as server then in "work directory "of tomcat there u can find the servlet.
Posted by: M.Santosh Kumar
Contact M.Santosh Kumar
servlet is runs on the server.It has only business logic. jsp is mixing of html and java.
JSP page has both presentation logic and business logic.
Posted by: Rahman khan
Contact Rahman khan
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.