JSTL helps needed


Web tier: servlets, JSP, Web frameworks: JSTL helps needed

  1. JSTL helps needed (2 messages)


    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>


    Now my question is, how one can replace the else related part from my JSP, plz help me.

    Threaded Messages (2)

  2. JSTL helps needed[ Go to top ]

    How about:
    <c:if test="${empty sessionScope.userName}">
  3. use <c:choose>[ Go to top ]

      <c:when test="${sessionScope.userName != null}">
           <!-- your code -->
          <!-- else part code -->