" tag; 2. Introduce it through the src attribute of the script tag, with the syntax ""."/> " tag; 2. Introduce it through the src attribute of the script tag, with the syntax "".">

Home  >  Article  >  Web Front-end  >  What tags do you use to write javascript in jsp?

What tags do you use to write javascript in jsp?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-06-11 10:43:163540browse

In jsp, use script tag to write javascript code. The writing method is: 1. Write directly in the "3f1c4e4b6b16bbbd69b2ee476dc4f83a2cacc6d41bbb37262a98f745aa00fbf0" tag; 2. Introduction through the src attribute of the script tag, the syntax is "ac9d159c3a22d009e5e272989382408d

What tags do you use to write javascript in jsp?

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

In addition to JSP predefined actions, developers can also use the JSP tag extension API to add their custom actions. You can use the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag in jsp to add JavaScript code.

There are two ways to write JavaScript scripts in JSP pages:

1. Write JavaScript code directly in the 3f1c4e4b6b16bbbd69b2ee476dc4f83a2cacc6d41bbb37262a98f745aa00fbf0 tag

<script type="text/javascript">
function test(){
alert("test");
}
</script>

2. Write it in a js file, and then introduce it into the page through the src attribute of the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag

<script type="text/javascript" src="json.js" ></script>

The difference between JavaScript and jsp:

jsp technology is web The server-side technology of the website can be simply understood as jsp technology, which is used to generate dynamic web pages. Ordinary web pages are html, which are static and need to be written in html language in advance.

Then we add some java code to the html page and insert the dynamic content of the java code part into the original html page. Then, this page can become a jsp page. That is, jsp=htmljava.

Javascript is the client-side technology of the web. It is a scripting language that does not require compilation and is interpreted and executed by the browser. It is also inserted into the html page. The execution of javascript scripts is event-driven.

When the browser loads the HTML page and the user clicks on the button or text box on the page, if the page has written event JavaScript scripts for these buttons or text boxes, then the user is responding The execution of these scripts will be triggered when an action is taken. JavaScript scripts can respond to client actions without communicating with the server.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What tags do you use to write javascript in jsp?. 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