为什么html支持EL而不支持OGNL

html-css015

为什么html支持EL而不支持OGNL,第1张

你先区分这几个

${request.user.username} el表达式

<s:property value=""/> struts标签

value="" 中值的部分 叫做ognl表达式 也就是 #user.userID

ognl表达是是取struts值栈中值的表达式,只有在能出现ognl表达式的标签中才能用

你在html的普通标签中用当然不行了

首先你要明白$(".rodnum")代表的是什么 ,它是所有类样式rodnum的集合,注意它是一个集合

$(".rodnum").each(function(index, el) {

         var str = $(el).text()

         var s = str.substring(1, str.indexOf(1))

         if ("G" == s && str.length == 4) {

             $(el).css("background", "red")

         } else {

             $(el).css("background", "#009554")

         }

         if ("S" == s) {

             $(el).css("background", "orange")

         }

         if ("X" == s) {

             $(el).css("background", "white")

             $(el).css("color", "black")

         }