I have to make a simple application which will run on a server and will wait or client requests. When a client calls it, it will simple send him a String.
Should I do this in JSP or Servlet? Which is a better choice?
Printable View
I have to make a simple application which will run on a server and will wait or client requests. When a client calls it, it will simple send him a String.
Should I do this in JSP or Servlet? Which is a better choice?
If you just want to send a String to the client, then Servlet is the ideal choice.
Remember, a JSP page is converted into a Servlet and then executed, which means its a bit slow. Prefer JSP if you intend to send HTML responses.
I hope this helps.
That explains.
Thanks mate.
Java Server Pages - document-centric
Servlets - look and act like programs
It is easier to write HTML in JSP using different HTML editors which is not true for Servlets.
I hope this helps.
In the MVC term JSP is more for the view on how your application will look and the Servlet act as a controller for your web application. So to process a request request it better to do it in a servlet and then send the result to the client by using a JSP page.