比较Enum EL Jboss [英] Compare Enum EL Jboss
问题描述
枚举类:
public enum Status {
VALID,
NOT_VALID,
OTHER,
;
public String getName(){
return name();
}
}
JSP的一部分:
...
,但仍然不起作用。另外我已经使用Java 1.7和Java 1.8进行了测试。
<%@ page import =my.package.Status%>
...
< c:choose>
< c:when test =$ {myVar.status.toString()== Status.VALIDAD.toString()}>
< c:set var =clasevalue =green-text/>
< / c:当>
< c:when test =$ {myVar.status.toString()== Status.NOT_VALIDADO.toString()}>
< c:set var =clasevalue =yellow-text/>
< / c:当>
< c:否则>
< c:set var =clasevalue =red-text/>
< / c:否则>
< / c:choose>
< span class =$ {clase}>
<% - 输出测试 - %>
[$ {myVar.status}] - <% - 在Tomcat和Jboss中工作 - %>
[$ {Status.VALIDAD.toString()}] - <% - 在Tomcat中工作,在Jboss中为空 - %>
[$ {Status.VALIDAD}] - <% - 在Tomcat中工作,在Jboss中为空 - %>
[$ {Status.VALIDAD.name}] - <% - 在Tomcat中工作,在Jboss中为空 - %>
[$ {Status.VALIDAD.name()}]<% - 在Tomcat中工作,在Jboss中为空 - %>
< / span>我已经阅读过这个和这个,但我不明白,因为在Tomcat中的作品,而不是Jboss。
有些想法?
$ b $我已经尝试过Jboss EAP 7.0.0,其中包括库
$ b-api_3.0_spec-1.0.6.Final-redhat-1.jar
解决方案很可能您的JBoss使用另一个JSP / Servlet API版本,而不是您的Tomcat
从另一个与此相关的问题:
JSP / Servet 2.4不支持EL中的方法调用,只支持
属性。
I'm trying compare two enum values in JSTL. In my Tomcat works fine, but when I deploy the application in a Jboss doesn't work.
Enum class:
public enum Status { VALID, NOT_VALID, OTHER, ; public String getName() { return name(); } }
Piece of JSP:
... <%@ page import="my.package.Status" %> ... <c:choose> <c:when test="${myVar.status.toString() == Status.VALIDAD.toString()}"> <c:set var="clase" value="green-text" /> </c:when> <c:when test="${myVar.status.toString() == Status.NOT_VALIDADO.toString()}"> <c:set var="clase" value="yellow-text" /> </c:when> <c:otherwise> <c:set var="clase" value="red-text" /> </c:otherwise> </c:choose> <span class="${clase}"> <%-- Output tests --%> [${myVar.status}] - <%-- Works in Tomcat and Jboss --%> [${Status.VALIDAD.toString()}] - <%-- Works in Tomcat, empty in Jboss --%> [${Status.VALIDAD}] - <%-- Works in Tomcat, empty in Jboss --%> [${Status.VALIDAD.name}] - <%-- Works in Tomcat, empty in Jboss --%> [${Status.VALIDAD.name()}] <%-- Works in Tomcat, empty in Jboss --%> </span>
I have readed this and this, but I don't understand because works in Tomcat and not in Jboss.
Some idea?
EDIT:
I have tried with Jboss EAP 7.0.0 that includes the library
jboss-el-api_3.0_spec-1.0.6.Final-redhat-1.jar
, but still doesn't work. Also I have tested with Java 1.7 and Java 1.8.解决方案Most likely your JBoss uses another JSP/Servlet API version than your Tomcat.
From another question related to this one:
JSP/Servet 2.4 doesn't support method calls in EL and only support properties.
这篇关于比较Enum EL Jboss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!