Hello,
Can anyone plz tell me how to convert follwing piece of JSP code into JSTL
<%@ taglib uri="http://java.sun.com/jsp/jstl/core_rt" prefix="c_rt" %>
<%
String sUserName= (String)session.getAttribute("userName");
if (sUserName != null)
{
%>
The above part is all right I implemented using
<c_rt:if test= "${sessionScope.userName != null}">
<%
} // this can be replaced by </c_rt:if>
else{
%>
<%
}
%>
Now my question is, how one can replace the else related part from my JSP, plz help me.
Ciao
RD
-
JSTL helps needed (2 messages)
- Posted by: Ranendra Das
- Posted on: August 02 2005 03:07 EDT
Threaded Messages (2)
- JSTL helps needed by Duncan Mills on August 02 2005 11:38 EDT
- use <c:choose> by Hiren Pathak on August 09 2005 14:34 EDT
-
JSTL helps needed[ Go to top ]
- Posted by: Duncan Mills
- Posted on: August 02 2005 11:38 EDT
- in response to Ranendra Das
How about:
<c:if test="${empty sessionScope.userName}"> -
use <c:choose>[ Go to top ]
- Posted by: Hiren Pathak
- Posted on: August 09 2005 14:34 EDT
- in response to Ranendra Das
<c:choose>
<c:when test="${sessionScope.userName != null}">
<!-- your code -->
</c:when>
<c:otherwise>
<!-- else part code -->
</c:otherwise>
</c:choose>