I can do every thing using jsp itself,then what is the need of using servlet?in which situation ,we must use servlet with jsp?

Showing Answers 1 - 4 of 4 Answers

Amit Kumar

  • Feb 7th, 2006
 

We cann't implements interface in Jsp but it is in the servlet. Yes, it is true, we can every thing in JSP as in the servlet. But, Jsp is always used for design layout or view whereas the servlet is used to code the business logic.

Why is it in servlet? Because Servlet is the .java file and we simply write the java code for controlling the business. The servlet is controlled by web container and it creates it multiple instances automatically.

  Was this answer useful?  Yes

JSP's are for view.

You are normally supposed to just view the O/p using JSP.

Servlets are the controller classes,
They delegate the requests to the appropriate business logic class (Model) to execute the request and pass the response back to the Jsp page.
This helps in clear segregation of the entire architecture according to the functionality.It helps in cohesion.Also , if you put all of the content in Jsp using scripting, you will have a tough time debugging the entire web application.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions