2012-06-21 38 views
1

我想显示的链接,如果行的值等于“总计”其他纯文本我想下面片断,但得到的错误如果条件显示标签?

<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> 

错误:

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 
+0

有什么错误? – Ankit

+0

编译时错误。请参阅上面更新的文章 – happy

回答

4

不要使用小脚本。决不。使用JSTL和EL。并且要明白,EL不能在scriptlet中使用:脚本包含Java代码,EL不是Java。

此外,如果特定行不是总计,代码将添加一列。这不是应该做的。列应该永远存在,但其内容应视该行更改:

<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>