0

I have Xhtml page wrote by jsf, I'm not sure what happen into the page that test failed one condition and always true or false , I check test condition and said the false and true happen the way suppose to do!.

This is my head tags in xhtml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
>

And This is the xhtml Choose and otherwise :

<c:forEach items="#{pwaService.tickets}" var="tik">
                                        <c:choose>
                                            <c:when test="${pwaService.isTicketFromUser(tik.from) eq true}">
                                                <div class="msg right-msg">
                                                    <div class="msg-bubble">
                                                        <div class="msg-info">
                                                            <div class="msg-info-name">#{tik.from.name}</div>
                                                            <div class="msg-info-time">#{pwaService.time(tik.sentDate)}</div>
                                                        </div>
                                                        <div class="msg-text">
                                                            #{tik.message}
                                                        </div>
                                                    </div>
                                                </div>
                                            </c:when>
                                            <c:otherwise>
                                                <div class="msg left-msg">
                                                    <div class="msg-bubble">
                                                        <div class="msg-info">
                                                            <div class="msg-info-name">مدیر سامانه</div>
                                                            <div class="msg-info-time">#{pwaService.time(tik.sentDate)}</div>
                                                        </div>

                                                        <div class="msg-text">
                                                            #{tik.message}
                                                        </div>
                                                    </div>
                                                </div>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>

The condition test="${pwaService.isTicketFromUser(tik.from) eq true}" tested and return false and true. but in rendered page(html) it's always when executed Although the test need to execute the otherwise!

    public boolean isTicketFromUser(User from) {
        return !from.getId().equals(UUID.fromString("hiddenUUID"));
    }

in simple speak in this code the condition is false but the block of right-msg show up in html!

0 Answers0