Home  >  Article  >  Web Front-end  >  What is the difference between javaweb and javascript

What is the difference between javaweb and javascript

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-21 12:00:0854983browse

The difference is: 1. Javaweb is a web page code, and JavaScript is a page scripting language that can achieve dynamic effects on various pages, such as pop-up boxes, hiding, etc.; 2. JavaScript generally runs in the foreground and requires browsing The server must support js, and javaweb is on the background server.

What is the difference between javaweb and javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

java web (JSP): web page code

javascript: a page scripting language that can achieve dynamic effects on various pages, such as pop-up boxes, hiding, etc.

1. What is Javascript?

It is a scripting language that runs in the browser. In web pages, Javascript can be said to be omnipotent:

1. Can operate HTML, providing a tool to change HTML at runtime;

2. Can attach and execute events, in line with the idea of ​​event-oriented programming;

3. Data verification function, after submission Verify the legality of the form data when forming;

4. Operations on the customer's browser, such as forward, backward, refresh, jump, open a new window, print, etc.;

5. Yes Create and use Cookies.

2. What is Java?

Java Web is a technology stack that uses Java technology to solve related web and Internet fields. The web consists of two parts: web server and web client. Java's client-side applications include Java Applets, but they are rarely used. Java's server-side applications are very rich, such as Servlet, JSP, third-party frameworks, etc. Java technology has injected strong impetus into the development of the Web field.

JavaWeb has entered the field of Java EE, which is Java Enterprise Edition, the enterprise version of Java. When you look at the web, you should think that it is related to the Internet. In fact, when developing JavaWeb applications, JSP ( Java Server Pages) servlet Javabean is developed. Large websites are generally developed using frameworks, such as struts, hibernate, and spring. For example, in schools, you will see Login.do in the address bar when logging in, and you will see it after logging in. Requests like Home.do are typical struts framework structures.

3. The origin of the name of Javascript

JavaScript was first called Mocha, which is the code name of this project. This name was used until the release of Netscape 2.0 beta 2 (95.11.04) - including the name Mocha on the error box that popped up in beta 1. However, as early as September 18th, netscape had announced that it would enable a server-side script (no name mentioned) in LiveWire. And because of the "front-end and back-end universal script" design we mentioned earlier, the language used the internal name LiveScript when beta 2 was released.

But what is equally confusing is that Netscape has actually decided to name the language "JavaScript" at this time. Therefore, the language is called JavaScript in the beta 2 release memo, but the interface has been changed from Mocha to LiveScript. This situation lasted until December 4, when netscape and sun jointly issued a statement officially launching the name JavaScript. Then beta 4 was released (95.12.20), and the interface and documentation were unified.

So in fact, the life cycle of the name "LiveScript" that can be verified is only one month (95.11.04-12.04). But after all, Mocha is just the project code name, not the product name, so later when people traced the history of JavaScript, most of them only mentioned LiveScript.

Extended information:

The difference between Java and Javascript

1. JavaScript and Java are different products developed by different companies. JavaScript is a product of Netscape. Its purpose is to expand the functions of Netscape Navigator and develop an object-based and event-driven interpreted language that can be embedded in Web pages; and Java is a new generation of object-oriented language launched by SUN Microsystems. Programming language, particularly suitable for Internet application development. In fact, the original name of javascript was not javascript, but LiveScript. The "Java" in the name was authorized by SUN Microsystems.

2. JavaScript is object-based. It is a scripting language and an object- and event-driven programming language. Therefore, it itself provides a very rich set of internal objects for designers to use. Java is object-oriented, that is, Java is a true object-oriented language. Even when developing simple programs, objects must be designed.

3. The embedding methods of javascript and Java are different. In the HTML document, the two programming languages ​​​​are identified differently. JavaScript uses Applet to identify it, while Java uses Applet to identify it.

4. JavaScript and Java are executed differently in browsers. JavaScript is an interpreted programming language. Its source code does not need to be compiled before being sent to the client for execution. Instead, the character code in text format is sent to the client. That is, the JavaScript statement itself is downloaded along with the Web page and is processed by the browser. Explanation and execution. The Java source code must be compiled before being passed to the client for execution. Therefore, the client must have an emulator or interpreter on the corresponding platform. It can be compiled independently of a specific platform through a compiler or interpreter. code.

5. JavaScript and Java code formats are different. JavaScript code is an address format that can be directly embedded in HTML documents and can be dynamically loaded. Writing HTML documents is as convenient as editing text files. The format of its independent file is X.js. Java is a format that has nothing to do with HTML. It must be loaded like foreign media is quoted in HTML. Its code is saved in an independent document in the form of byte code. The format of its independent file is X.class.

6. The variables used by javascript and Java are different. The variable declaration in JavaScript adopts weak type, that is, the variable does not need to be declared before use, but the interpreter checks its data type at runtime. Java uses strong type variable checking, that is, all variables must be declared before compilation.

7. JavaScript uses dynamic binding, that is, JavaScript object references are checked at runtime. Java uses static binding, that is, Java object references must be made at compile time so that the compiler can implement strong type checking.

8. JavaScript does not directly operate text and graphics. It works together with HTML element combinations in Web pages, but it can control the browser and allow the browser to directly process text and graphics. Java can directly operate on text and graphics.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What is the difference between javaweb and javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn