El siguiente código JSF contiene dos <c:if></c:if>
separados. Veámoslo.La representación de if-elseif-else en EL usando JSF
<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title>JSF EL</title>
</h:head>
<h:body>
<h:form>
<c:set scope="request" var="row" property="x" value="10"/>
<c:if test="#{row==10}">
<h:outputLabel value="value = 10"/>
</c:if>
<c:if test="#{row==15}">
<h:outputLabel value="value = 15"/>
</c:if>
</h:form>
</h:body>
</html>
Simplemente muestra valor = 10 en la página JSF en tiempo de ejecución. Necesito representar el anterior <c:if></c:if>
con el siguiente if-elseif-else (contexto Java).
if(row.equals(10))
{
//Do something...(JSF stuff)
}
else if(row.equals(15))
{
//Do something...(JSF stuff)
}
else
{
//Do something...(JSF stuff)
}
¿Cómo puede ser representado con Expression Language (EL) usando JSF?
posible duplicado de [mostrando condicionalmente elementos HTML] (http://stackoverflow.com/questions/4870462/conditionally-displaying-html-elements) – BalusC