js use EL expressions summary

1.js el expressions used to add double or single quotes: '$ {list}'


Gets an object variable 2.js el expressions: You can not direct access, direct access toString get is the value of the object.


There are two methods:
a: el directly write the object's properties var abc = '$ {list [ 0] .index}'; -------- expressions as el mounted object with each array variable js Attributes

II: first object into json json and then converted into an object assigned to the js variable.

 

  • Control used in the JS EL expressions , beginning with the source code as follows:

  • varselected = ${requestScope.xxxxForm.recordNumPerPage}

Js always so wrong, because at first when requestScope.xxxxForm.recordNumPerPage is null.

  • So under the guidance of boss, the simple addition of two quotation marks, the code becomes

  • var selected = “${requestScope.xxxxForm.recordNumPerPage}”

Function automatically. 

In short, in the js el expression must use double quotes.

If $ {sessionScope.userName} acquired from the server to the value of Joe Smith, then the final browser obtained is interpreted as a result of this

var message = Zhang;

This is certainly not enough, javascript string must be enclosed in quotation marks, like var message = "John Doe"; or like var message = 'John Doe'; only right, so this is the next to know why the javascript use el expressions must use quotation marks cause it, either single or double quotation marks, in short, is caused to use quotation marks.

Like alert ($ {sessionScope.userName}); The wording browser final result is interpreted alert (Joe Smith) get; so this issue will certainly be written, only alert ( "$ {sessionScope.userName}"); write or alert ( '$ {sessionScope.userName}'); can be written, the browser performs the final result is interpreted alert ( "John Doe") obtained; and alert ( 'John Doe');

There is, if $ {sessionScope.age} removed from the server is a figure? For example, $ {sessionScope.age} value is removed from the server 16, then to do without the quotation marks?

alert ($ {sessionScope.age}); browser final result is interpreted alert (16) get; you yourself think about it, the javascript syntax, the numbers do not add quotation marks to it? Defined in javascript a numeric type variable like var age = 16; write without any problem, and then alert (age); normal pop-16, no problem, if we like var age = "16" or the like var age = '16' write it? no problem, but here in quotes is a string of 16. So whether EL expressions from the server to fetch the value is a string of numbers or, best put in inverted commas, do so safer, and relatively easy way, whether it is single or double quotation marks quotation marks, quotation marks conclusion is certainly no problem . If the EL expressions take the value from the server to a number, this number in javascript to put quotation marks around it does not matter, if the client use this added digital quotes do the math, we can use this function in javascript in quotes into a digital type digital operation do! For example var age = "$ {sessionScope.age}", the results obtained after the browser is interpreted var age = "16"; resort we client using a conversion function of javascript, the age = "16" from a string type do the math to convert to digital type!

Var    [and: (r)]   detailed X
Basic translation
. N (Var) name; (F, R) Val; (Cambodia) W
abbr value-added reseller (value-added reseller);. Vertical Aircraft Rocket (Vertical Aircraft Rocket)
Web definitions
var: Var
var left: block left position
var top: the position block

 

Guess you like

Origin www.cnblogs.com/zhaoyanhaoBlog/p/11298743.html