In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "whether javascript can use el expression". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Javascript can use el expressions. Method: 1, JavaScript code in the JSP page, directly use EL expression, syntax is "$(function () {new... (" ${param.alert} ");});"; 2, use the form of pre-defined JS variable.
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
Can javascript use el expressions?
EL (Expression Language) is designed to make JSP easier to write. The expression language, inspired by the ECMAScript and XPath expression languages, provides a way to simplify expressions in JSP, making the Jsp code even easier.
The method of using el expressions in JavaScript.
1. The JavaScript code is in the JSP page, which can be directly used by EL expressions. Such as:
(function () {new BacklogOverview ("${param.alert}");})
2. JS code is a separate .js file, which is introduced into JSP. This can be solved by defining JS variables in advance, such as:
Var contextPath = "${contextPath}"
EL syntax
Accessing model objects in JSP is expressed through the syntax of EL expressions. All EL expressions are formatted as "${}". For example, ${userinfo} means to get the value of the variable userinfo.
When the variables in the EL expression are not given a range, they default to look in the page range, and then look in the request, session, and application ranges. You can also use a range as a prefix to indicate which range variables belong to, for example: ${pageScope. Userinfo} means to access the userinfo variable in the scope of page.
This is the end of the content of "whether javascript can use el expressions". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.