在jsp中使用java枚举

public enum EnumLottery {
A(0,"签到"),B(1,"关注公众号"),C(2,"邀请好友"),D(3,"抽奖"),E(4,"新人奖励");
private Integer code;
private String name;

private EnumLottery(Integer code ,String name){
this.code=code;
this.name=name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

}



<c:forEach items="<%=EnumInviterCount.values()%>" var="eic">
<c:if test="${item.reason == eic.code}">
<td>${eic.name}</td>
</c:if>
        </c:forEach>

猜你喜欢

转载自blog.csdn.net/qq_36719449/article/details/80902006