无论何时做<c:set var="name" value="1"/>
, #{name}
#{name.class}
证明总是一个字符串.
有什么方法可以在 JSF/Facelets 上下文中设置一个 Integer 或 Long 文字值的范围属性?
最佳答案
EL 具有自动类型转换。此 article有一些很好的信息。但是,缺点是你不应该在意。只要 param.month 实际上是一个整数,您就应该能够执行以下操作。
<c:set var="myInteger" value="${param.month}"/>
<p>
The value of myInteger is:<c:out value="${myInteger}"/>
Perform a multiplication operation to show that the type is correct:
<c:out value="${myInteger *2}"/>
关于jsf - 使用 c :set to set a non-string value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2464449/