0

I have this .tag file:

<%@tag description="Displays reduced information for analysis jobs" pageEncoding="ISO-8859-1"%>
<%@attribute name="job" required="true" type="redb.main.core.model.AnalysisJob"%>

<div class="analysis-job-reduced" data-job-id="${job.id}">
<p><span class="job-id">Job ${job.id}</span>: <span class="status">${job.status}</span></p>
<p class="prio">Prio: ${job.prio}</p>
<p class="executive">${job.executive.name}</p>
<p class="waiting-for">Waiting for ${job.textWaitingFor}</p>

I want to display the variable "job.prio"-variable, just in the case "job.status" is equal "open". That means, if "job.status" is other than "open", nothing will be displayed after "Prio: "

I tried this, but it didn't work..

<div class="analysis-job-reduced" data-job-id="${job.id}">
<p><span class="job-id">Job ${job.id}</span>: <span class="status">${job.status}</span></p>
<%-- <p class="prio">Prio: ${job.prio}</p> --%>
<c:choose>
    <c:when test="${job.prio = 'open'}">
        <p class="prio">Prio: ${job.prio}</p>
    </c:when>
    <c:otherwise>
        <p class="prio">Prio: Job is not open anymore</p>
    </c:otherwise>
</c:choose>
<p class="executive">${job.executive.name}</p>
<p class="waiting-for">Waiting for ${job.textWaitingFor}</p>

Thank you so much for your help!

ZelelB
  • 1,836
  • 7
  • 45
  • 71
  • http://stackoverflow.com/questions/4587397/how-to-use-if-else-option-in-jstl ? – Birgit Martinelle Aug 27 '15 at 16:44
  • @BirgitMartinelle thank you! but it is too general explained.. I didn't really got it. should I use "job.prio" or "prio"? how can I applicate it of the example above? – ZelelB Aug 31 '15 at 12:22

1 Answers1

0

Here is the code that worked:

<div class="analysis-job-reduced" data-job-id="${job.id}">
<p><span class="job-id">Job ${job.id}</span>: <span class="status">${job.status}</span></p>
<%-- <p class="prio">Prio: ${job.prio}</p> --%>
<c:choose>
    <c:when test="${job.status == 'open'}">
        <p class="prio">Prio: ${job.prio}</p>
    </c:when>
    <c:otherwise>
        <p class="prio">Prio: Job is not open anymore</p>
    </c:otherwise>
</c:choose>
<p class="executive">${job.executive.name}</p>
<p class="waiting-for">Waiting for ${job.textWaitingFor}</p>

ZelelB
  • 1,836
  • 7
  • 45
  • 71