EL char

描述:在jsp里用 ${order.isNeedInvoice=='N'? 'checked':''}  ,isNeedInvoice 在后台是character类型的。

问题:报错,javax.el.ELException: Cannot convert N of type class java.lang.String to class java.lang.Long

查了资料,发现说EL表达式没有CHAR类型,他会把CHAR转成LONG,

参考:https://bz.apache.org/bugzilla/show_bug.cgi?id=52666,tomcat BUG?

EL官方文档:

A {<,>,<=,>=,lt,gt,le,ge} B 

■ If A==B, if operator is <=, le, >=, or ge return true. 
■ If A is null or B is null, return false 
■ If A or B is BigDecimal, coerce both A and B to BigDecimal and use the return 
value of A.compareTo(B). 
■ If A or B is Float or Double coerce both A and B to Double apply operator 
■ If A or B is BigInteger, coerce both A and B to BigInteger and use the return 
value of A.compareTo(B). 
Chapter 1 Language Syntax and Semantics 13 
■ If A or B is Byte, Short, Character, Integer, or Long coerce both A and B to 
Long and apply operator
 
■ If A or B is String coerce both A and B to String, compare lexically 
■ If A is Comparable, then: 
■ If A.compareTo(B) throws exception, error. 
■ Otherwise use result of A.compareTo(B) 
■ If B is Comparable, then: 
■ If B.compareTo(A) throws exception, error. 
■ Otherwise use result of B.compareTo(A) 
■ Otherwise, error

CHAR类型,还是别出现的好,在后台转成String 吧

猜你喜欢

转载自cainiao1923.iteye.com/blog/2221558
EL