please anybody tell me the difference between javascript and jsp.

JavaScript is executed by the browser on your local machine. JSP is executed by the server which hosts the site. So when you visit a page written in jsp, the server executes the jsp and then delivers the page across the internet connection to your browser. If any JavaScript is in the page, your browser will then execute it.

Javascript is client-side scripting language which is used to intract with the client at front ent ie Brower. Where as JSP is server-side scripting which enables us to write code in java and use java classes to perform various operation such as database intraction etc. and to generate HTML on the basis of database like generating HTML-table to show employee details.

JSP is server-side scripting

a page written in jsp,

You correct on the point that JSP is server side, however it is not either above, but

A JSP page is a text document that contains two types of text: static data, which can be expressed in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which construct dynamic content.

For the main difference JSP is Java web technology that is product of Sun Microsystems, where JavaScript is product of Netscape

Hi peter_pudo,

You have mentioned: "For the main difference JSP is Java web technology that is product of Sun Microsystems, where JavaScript is product of Netscape "

can you explain what is the use of JSP if it is not used as server-side scripting. As far as I know when ever we want to entract with the server we have to use some scripting language through which we can generate Dynamic HTML.

What Say?

I am not a Java developer so I may be speaking out of turn here, but don't you have to install Java on the local machine in order to run it? If that's the case then can you actually classify it as a server side language?

If ur sever is on Local machine then u have to installed java else it should be in the server.

Yes, you need only Java if you try to run local server for what ever purpose (testing, small company intranet) otherwise JSP page is on visitor request translated to plain HTML format.

JSP is presentation layer for all work done by logic layer in servlet.
JSP as said is a mixture of HTML elements and JSP. The JSP elements are small chunks of Java which will do certain things. For example I need to declare 10 radio buttons, I will use array to store the names and I will just simply loop thought to get them on screen. Beside these simple things they can pass data between pages. This include server processing in servlet. Servlet is basically java class running on server which does all heavy work (calculations, database connectivity, security etc). Because of JSP ability to work with Java many idiots still try to do database connectivity from it, which is wrong...

JSP are compiled to .class files, that is equivalent to java .class files. Then why it is wrong to do database connecivity on JSP.

To show data from database we have to connect to database, wether we are doing it in servlet or JSP all are same coz they are all compiled to .class files.

Then why it is wrong to do database connecivity on JSP.

Efficient and effective work
While you learn basics of Java web development you are not doing complex stuff. Once you start real life job you have to take care of various things and if you intend to do while job with scriplets ( small chunks of embedded Java) you find out it is impossible task as code get to large and difficult to maintain (you will be pulling hair out of your head after redesigning JSP page after 6 months of use and you working on different project or repairing damage done by somebody else laziness). Secondly in large organizations there are usually two side to project

  • business application designer
  • web page designer

each of them has they own set of skills.

"While you learn basics of Java web development you are not doing complex stuff"


And what is that complex stuff. can u please explain me.

commented: You are one cool dude. +1

What variables we use in JavaScript?

Ah hello i'm 23 years old right now hehehehe. No just joking, the simple answer is JSP java server pages which can be created in java platform(you need it to test your code, first its actually more powerful than any (Common Gateway Interfaces)CGI. And java script runs on what SAMS book and I ahmm command line interpreter(meaning it execute the code line if it pass through it included are function calls of course). Java script can run without a compiler but JSP must be compiled first. TIP "what is the difference between scripts and programs" nothing spelling hehehehe but to my experience scripts need not a compiler(just a command line interpreter) but programs must be compiled first(some compiled first for the first time and check timestamp if it is same do not compile run the one in cache or something).

So you can't make programs out of PHP, JavaScript, Ruby, ASP, BASIC, Perl?

As long as their is an interpreter you can create programs in scripts but not that powerful enoungh like security thoughts even though in scripts their is security but on a questionable manner. That is why if you ask a programmer what is the difference between scripts and programs? no common answer ryt?its either yes or no. To be cleared what is the difference between parameters and arguments, some books say nothing , but deeper thought thr is.

That is why if you ask a programmer what is the difference between scripts and programs? no common answer ryt?

Actually, I think you usually get this answer: http://en.wikipedia.org/wiki/Scripting_language

A scripting language, script language or extension language, is a programming language that controls a software application. "Scripts" are often treated as distinct from "programs", which execute independently from any other application.

Meaning that a script supports a program and a program runs independently. With this definition, Javascript would be a scripting language because it requires the browser to run, most server side languages including interpreted languages would be programming languages, given that they run independently.

Actually, I think you usually get this answer: http://en.wikipedia.org/wiki/Scripting_language

Meaning that a script supports a program and a program runs independently. With this definition, Javascript would be a scripting language because it requires the browser to run, most server side languages including interpreted languages would be programming languages, given that they run independently.

I think that definition would mean that every programming language on a web server is a scripting language since it supports the web server's task of serving HTML. lol.. Just as JavaScript does it for the serving of HTML on the browser...
BTW: JavaScript can be run independently on the server to serve your HTML files - though the interpreter would have to be in C or Java etc. In this case JavaScript can't really be called a scripting language by the definition from wikipedia...

But javascript was designed for that and only that purpose, and is in fact limited to that. Trying to do anything with the file system would be a nightmare. I think that is what defines it as a scripting language.

When i answered that question it just happen that i pass by this site. I just answered it by what is in my mind that time no joke its already around 3:55 am in Singapore see the reason why? started to love reading when i was 21 'bout computers ,though i hate to define it by what is exactly in the books hehehe you just try to get the main idea . Nope i told you its books and sometimes ebooks you want some hot stuff and if u wnt some hot stuff from java i know one it really help. promise. just post again hehehe. By the way my name is David for formalities issues. The idea about that is provided by two books that i've read which is JAVA for intro by savitch and java for professional developers by morgan ah i more its by SAMS learn java in 24 hours hehehehe.Ok its already 4 am so im going to bed.ARIGATOU ,SAYONARA, By the way my site its not yet available because its under construction. Can u give me some hosting which provides it for free no banner, ASP/PHP, MSACCESS.I try to post first then the banner is on top of my page, so i created a Javascript that will force it to be at the bottom.Thanx.

But javascript was designed for that and only that purpose, and is in fact limited to that. Trying to do anything with the file system would be a nightmare. I think that is what defines it as a scripting language.

JavaScript was designed for the browser and still is it's main use but its usefulness has outgrown just the browser.
It can run on the server side, just like PHP, Java etc.
It can be a standalone desktop application such as Firefox - which is I think more than 90% JS.

Being interpreted doesn't mean it can't be used just like a "real" programming language or would be limited to just providing a scripting "interface".

File system access doesn't really define a scripting language either. On the browser the only reason JS does not access the file system is security. Its only by implementation - run on the server or a desktop app like firefox, file system access is just like any other language with JS.

I think PHP suffers the same as JS. Because it is interpreted, its assumed use is just scripting. But it has grown out of being just scripting/templating of HTML on servers. It assumes all the functionality of a non-interpreted or compiled languages.

Efficient and effective work
While you learn basics of Java web development you are not doing complex stuff. Once you start real life job you have to take care of various things and if you intend to do while job with scriplets ( small chunks of embedded Java) you find out it is impossible task as code get to large and difficult to maintain (you will be pulling hair out of your head after redesigning JSP page after 6 months of use and you working on different project or repairing damage done by somebody else laziness). Secondly in large organizations there are usually two side to project

  • business application designer
  • web page designer

each of them has they own set of skills.

How does the validations checked in JAVASCRIPT?

what apps should be used for database for easy connectivity with java.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.