1

I am completely a newbie in Java. I want to know difference between Java and JSP if any. When i searched on the web i came across the following definitions.

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.

JavaServer Pages (JSP) is a technology that helps software developers create dynamically generated web pages based on HTML, XML, or other document types.

Can anyone list out the differences?

Paul P Elias
  • 146
  • 2
  • 7

3 Answers3

5

In short,

Java is object oriented computing language which can do almost anything you want to do.

JSP is technology based on java, JSP processor generates webpages using java language.

Amey Jadiye
  • 3,066
  • 3
  • 25
  • 38
2

Java is a pure object oriented language, by object oriented I mean, we create classes and instantiate objects of those classes. If you work with pure Java, simple difference you will notice is the output will be displayed on console, so we use different plugins for different kind of outputs (for eg. applets). Java is used as a core language meaning anything you write as a Java code is converted into machine level code, which can be interpreted by the processor.

Now when you say JSP, i.e. Java Server Pages, the name itself defines it. In simple terms, you embed your Java code into your HTML pages. If you are familiar with the concepts of servlets in Java, you may understand the complexities of using these servlets. JSPs on the other hand eases the work with HTML. The best example of a JSP page is that you can easily juggle your data to and from your HTML page to Java code, and one interesting fact about JSP is that it gets converted into servlets.

There are other various differences between Java and JSP but you need to be familiar with servlets to understand JSP.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
0

Basically Java is backend and JSP is frontend

Gonçalo Cardoso
  • 2,253
  • 4
  • 34
  • 63
  • JSP stands for JavaServer Pages and the name implies that it is not front end. it resides in the server and upon request for a JSP resource the JavaServer Pages compiler parses the JSP and transform them to Java Servlet. This compilation is done in the first request hence, a bit delay and subsequent requests are served with cached version of Servlet. – Raf Nov 13 '15 at 10:50
  • And what do the JSP ends up being? HTML? Isn't that frontend? – Gonçalo Cardoso Nov 13 '15 at 11:53
  • Don't understand why I got -2 votes and the accepted answer as +4 when we say the same. Although I used fewer words... – Gonçalo Cardoso Nov 13 '15 at 11:54
  • Aha! I have no idea who give you a down vote. JSP ends up being a Servlet. A Servlet receives the request, does processing and returns a response in the form of HTML. Obviously the container (i.e. Tomcat) is playing the role of receiving the request, forwarding it to the right servlet and taking the response back and giving it to the user. If you say JSP is frontend then so is Java Servlet (They will never be!). – Raf Nov 13 '15 at 12:17