#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    UK
    Posts
    10
    Rep Power
    0

    JSP JavaScript Servlets Java Server Pages - What's the difference?


    I've written a couple of enquiry facilties using files ending with ".jsp" and containg HTML and <% ...... %> code.

    What I would like to know is "what have I written"? Is it JSP, JavaScript, Java Servlets or Java server pages? Is there a difference between these things and, if there is, what is it?
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Santiago, CHILE
    Posts
    2
    Rep Power
    0
    You wrote a JSP page,

    There are to main differences:

    Javascript is browser interpreted code, as you load any web page containing this code it makes the browser behave in a certain form ex:change a picture when your mouse is over it.

    The difference betwen JSP & Servlets is basically that servlet are pre-compiled. As you request a JSP for the first time since the server's startup it takes a while until became a Servlet, so there's a little bit lack of speed.

    If you use tomcat just list the /work directory and you'll see your JSP pages that have became a servlet

    Guillermo
    Last edited by guillermog; June 11th, 2003 at 03:00 PM.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    UK
    Posts
    10
    Rep Power
    0
    So, I wrote a Java server page, which can also be called a JSP, it became a servlet after the first time it was accessed. Does that mean that the code between the <% ... %> tags is JavaScript?

    (To be honest, I'm only asking so that I can put things right in my mind. But I have found that some people get VERY uptight about what is referred to by a prticular name. Some people seem to think that using the correct words gives them a right to be elitist whereas I am simply interested in the end results and getting a job done. Sorry, slipped into rant mode there.)
  8. #5
  9. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    The problem stems from javascript. Javascript is not a Sun technology. It is not affiliated with Java. It is a client side(browser) scripting language, for the most part.

    Way back when, Netscape made a scripting language for their browser called Livescript. For some reason Sun and Netscape got together and Sun convinced them change the name to Javascript (Sun was trying to promote its new Java language as an applet/browser technology). This, and only this, is the relation between Java and Javascript.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    9
    Rep Power
    0
    hmm basically JSP is a file with <name>.jsp while servlet is <name>.java

    JSP is java codes embedded in html codes while sevrlet is html embedded in java codes

    JSP is excellent for form n field generation and servlet is excellent for being the controller ...

    when u edit a JSP file, u just need to refreash the browser n u will see the amended file.. while servlet u have to shutdown n run the tomcat server again ....

    *hope not too crappy but i guess it's the main difference*
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    106
    Rep Power
    12
    you need to restart the webserver? oh well, one more advantage about .NET

    peace

IMN logo majestic logo threadwatch logo seochat tools logo