Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to append an image to a cell value conditionally in a table. Its in a JSP and im using display tags for the table
    text
    copied!<p>I have a data table displayed in a JSP using DisplayTags. One of the columns in the table is a 'Priority' column. If the priority is 1, i have to be able to display a red light beside it. Is there any straight forward way of doing this?</p> <pre><code>&lt;display:column headerClass="tableHead" title="Priority" property="priority" sortable="false" /&gt; </code></pre> <p>I need to be able to show an image beside all cells with data value '1'.</p> <p>Update: i still dont see the image even though it dosent give an exception.</p> <pre><code>&lt;display:column headerClass="tableHead" title="Priority" property="priority" sortable="false" &gt;&lt;c:if test="${dispatchresults1.priority eq 1}"&gt;&lt;img src="images/flashinglight4.gif"/&gt;&lt;/c:if&gt; &lt;/display:column&gt; </code></pre> <p>This is the top of my table.</p> <pre><code> &lt;display:table htmlId="dispatchtable1" id="dispatchresults1" name="packedNotDispatchedlist" pagesize="20" style="width:100%;text-align:left;font-size:10px" class="thinBorder" requestURI="" export="true" &gt; </code></pre> <p><strong>Update: This is what worked for me finally.</strong></p> <pre><code>&lt;display:column headerClass="tableHead" title="Priority" sortable="false" &gt; &lt;c:choose&gt; &lt;c:when test="${dispatchresults1.priority eq 1}"&gt;&lt;img src="images/flashinglight4.gif"/&gt; &lt;/c:when&gt; &lt;c:otherwise &gt;${dispatchresults1.priority} &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/display:column&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload