JSP: Item page not found

Asked

Viewed 57 times

1

I am programming a page to inform you that the searched item has not been found. I wanted to know what I’m doing wrong and what would be a solution.

<c:forEach items="${proposta}" var="proposta">
            <div>
            <img src="..." alt="..." class="img-circle">
            <c:if test="${proposta.getTitulo() == 'null'}">
                <h1>Página não Encontrada</h1>
            </c:if>
            <br>
                <label>titulo:</label>
                <label>${proposta.getTitulo()}</label>
            <br>
                <label>subtitulo:</label>
                <label>${proposta.getSubtitulo()}</label>
            <br>
                <label>Necessidade:</label>
                <label>${proposta.getNecessidadeString()}</label>
            <br>
                <label>Area de Interesse :</label>
                <label>${proposta.getArea_interesseString()}</label>
            <br>
            <a class="btn btn-primary btn-sm" href="proposta?id=${proposta.getId_proposta()}">Exibir proposta </a>
            <br>
            </div>
        </c:forEach>
  • Why are you doing a foreach? Try to explain your question better.

1 answer

2

It shall be indicated in items the bean and the method, without the get at the beginning, which returns the list of proposals, example:

items="${managedBean.listaDePropostas}".

To show the result you do not need to use the get and even parentheses are not enough ${proposta.titulo}.

  • has q exports a JSTL Function library and then calls the length <c:when test="${fn:length(proposal) == 0 }"> <H3>No item found with this key</H3> </c:when>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.