Home Class literals in Expression Language
Reply: 0

Class literals in Expression Language

user1190 Published in July 22, 2018, 5:54 pm

I've found the literal expressions available in JSP EL listed here: https://docs.oracle.com/cd/E17802_01/j2ee/j2ee/1.4/docs/tutorial-update2/doc/JSPIntro7.html#wp77280

While most literals available in Java are available in EL, notably absent are character and class literals (cf. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html).


Integer.MAX_VALUE: ${Integer.MAX_VALUE}

displays fine, but when I try

Integer.class: ${Integer.class}

I get

javax.el.PropertyNotFoundException: Either 'class' is not a public static field of the class 'java.lang.Integer' or field is inaccessible
    at javax.el.StaticFieldELResolver.getValue(StaticFieldELResolver.java:106)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:204)

I'd really like to be able to pass a value like this into a custom tag. Is there any way to get this value in a JSP other than writing it in a Java Expression?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308742 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO