b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

ognl表达式和el表达式_ognl取值_jsel表达式和ognl(2)

电脑杂谈  发布时间:2017-02-12 08:02:31  来源:网络整理

<s:property value="#map[&#39;a&#39;]"/> ---------->正确,因为其支持char

${map[&#39;a&#39;]} ------------>错误, 因为&#39;a&#39;在jsp el表达式中是字符串,不能=char。

<s:property value=&#39;#map = #{"a":123, "b":234}, ""&#39;/> --->此时key是字符串

${map[&#39;a&#39;]}

补充:

在EL表达式规范2.2中,定义了:

写道

■ The value of an IntegerLiteral ranges from Long.MIN_VALUE to

Long.MAX_VALUE

■ The value of a FloatingPointLiteral ranges from Double.MIN_VALUE to

Double.MAX_VALUE

在tomcat7.0.6实现中,jasper.jar(实现了EL2.2规范):

AstFloatingPoint表示小数,AstInteger表示整数,其定义如下:

Java代码 public final class AstInteger extends SimpleNode

{

private volatile Number number;

public AstInteger(int id)

{

super(id);

}

protected Number getInteger()

{

if (this.number == null) {

try {

this.number = new Long(this.image);

} catch (ArithmeticException e1) {

this.number = new BigInteger(this.image);

}

}

return this.number;

}

public Class<?> getType(EvaluationContext ctx)

throws ELException

{

return getInteger().getClass();

}

public Object getValue(EvaluationContext ctx)

throws ELException

{

return getInteger();

}

}

Java代码 public final class AstFloatingPoint extends SimpleNode

{

private volatile Number number;

public AstFloatingPoint(int id)

{

super(id);

}

public Number getFloatingPoint()

{

if (this.number == null) {

try {

this.number = new Double(this.image);

} catch (ArithmeticException e0) {

this.number = new BigDecimal(this.image);

}

}

return this.number;

}

public Object getValue(EvaluationContext ctx)


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-31948-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 张红涛
      张红涛

      自由航行是指商船而不是军舰

    热点图片
    拼命载入中...