Results 1 to 5 of 5

Thread: JSP or Servlet

  1. #1
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default JSP or Servlet

    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?

  2. #2
    javagk is offline Member
    Join Date
    Nov 2007
    Posts
    12
    Rep Power
    0

    Default

    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.

  3. #3
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default

    That explains.
    Thanks mate.

  4. #4
    javaplus is offline Member
    Join Date
    Nov 2007
    Posts
    97
    Rep Power
    0

    Default

    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.

  5. #5
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    762
    Rep Power
    10

    Default

    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.

Similar Threads

  1. Servlet vs JSP
    By javaplus in forum Java Servlet
    Replies: 5
    Last Post: 06-26-2008, 10:19 PM
  2. my first servlet
    By sireesha in forum Java Servlet
    Replies: 3
    Last Post: 04-09-2008, 03:11 PM
  3. Regarding Servlet
    By Sudha in forum New To Java
    Replies: 1
    Last Post: 02-12-2008, 01:44 AM
  4. How to mix servlet & JSP
    By Swamipsn in forum Java Servlet
    Replies: 1
    Last Post: 08-08-2007, 12:57 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •