I want to display the link if value of row is equal to "GRAND TOTAL" else plain text I tried below snippet but getting error
<display:table name="expScoreCardCol" export="true" pagesize="20" sort="list" id="data" requestURI="" class="tablelist">
<display:column title="Zone" sortable="true" property="zone"></display:column>
<display:column title="Non-HNI Total" sortable="true" property="nonhniTotal"></display:column>
<display:column title="Non-HNI Per %" sortable="true" property="nonhniPer"></display:column>
<%if(!${data.zone}=="GRAND TOTAL"){ %>
<display:column title="Grand Total" sortable="true">
<html:link action="/exceptionScoreCardGrandReport.do?zone=${data.zone}"><b>${data.grandTotal}</b></html:link>
</display:column>
<%} %>
</display:table>
Error:
An error occurred at line: 270 in the generated java file
Syntax error, insert "while ( Expression ) ;" to complete DoStatement
An error occurred at line: 282 in the generated java file
Syntax error, insert "while ( Expression ) ;" to complete BlockStatements
An error occurred at line: 288 in the generated java file
Syntax error, insert "else Statement" to complete IfStatement
An error occurred at line: 288 in the generated java file
Syntax error, insert "}" to complete Block
Don't use scriptlets. Never. Use the JSTL and the EL. And understand that the EL can't be used inside a scriptlet: scriplets contain Java code, and the EL is not Java.
Moreover, the code adds a column if the specific row is not a grand total. This is not what should be done. The column should always be there, but its content should change depending on the row:
<display:table name="expScoreCardCol" export="true" pagesize="20" sort="list" id="data" requestURI="" class="tablelist">
<display:column title="Zone" sortable="true" property="zone" />
<display:column title="Non-HNI Total" sortable="true" property="nonhniTotal" />
<display:column title="Non-HNI Per %" sortable="true" property="nonhniPer" />
<display:column title="Grand Total" sortable="true">
<c:if test="${data.zone != 'GRAND TOTAL'}">
<html:link action="/exceptionScoreCardGrandReport.do?zone=${data.zone}">
<b>${data.grandTotal}</b>
</html:link>
</c:if>
</display:column>
</display:table>