使用 jstl 时预期获得相等符号

发布于 2024-10-06 23:37:11 字数 4864 浏览 1 评论 0原文

我正在得到

org.apache.jasper.JasperException:/WEB-INF/AllClientBatchDetails.jsp(54,103) 需要等号

这是我将请求属性设置为batchProgressMetricsList 的jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*%>   
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>   
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>   
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  


<html:html xhtml="true">   
<head>   
<title><bean:message key="progressReporter.successpage.title"/></title>  
<link rel="stylesheet" href="style.css">    
<html:base/>   
</head>   
<body>  
 <c:choose>   
  <c:when test="${empty batchProgressMetricsList}">  
   <font color=<bean:message key="error.font.color" />   size=<bean:message key="error.font.size" />>  
     <bean:message key="error.no.active.batch" />  
   </font>  
   <br/>  
  </c:when>  
  <c:otherwise>  
   <h4><bean:message key="table.header" /></h4>  
   <table border=<bean:message key="table.border.size" />>  
    <tr>  
     <th><bean:message  key="table.client.id.header" /></th>  
     <th><bean:message key="table.total.session.used" /></th>  
     <th><bean:message key="table.total.time.elapsed" /></th>  
     <th><bean:message key="table.imnts.completed" /></th>  
     <th><bean:message key="table.imnts.remaining" /></th>  
     <th><bean:message key="table.cores.allocated" /></th>  
     <th><bean:message key="table.time.remaining" /></th>  
    </tr>  
    <c:forEach var="aggregatedBatchProgressMetrics" items="${batchProgressMetricsList}">  
     <tr>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["clientId"]}</td>        
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["sessionUsedTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["sessionUsedTime"] % 60000)/1000, '.')}secs </td>  
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["totalElapsedTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["totalElapsedTime"] % 60000)/1000, '.')}secs</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsCompleted"]}</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsRemaining"]}</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["numberOfCores"]}</td>  
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["sessionRemainingTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["sessionRemainingTime"] % 60000)/1000, '.')}secs</td>  
      <br/>  
       <table>  
        <tr>  
         <th>session Id</th>  
         <th>taskId</th>  
         <th>task start time</th>  
         <th>task end time</th>  
        </tr>        
        ${aggregatedBatchProgressMetrics["batchMetricsList"][0]}  
        ${aggregatedBatchProgressMetrics["batchMetricsList"][1]}  
        ${aggregatedBatchProgressMetrics["batchMetricsList"][2]}  

        <c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics["batchMetricsList"]}">  
         <tr>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["sessionId"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskId"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskStartTime"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskEndTime"]}</td>  
         </tr>  
        </c:forEach>          
       </table>  
      <br/>  
     </tr>  
    </c:forEach>  
   </table>  
  </c:otherwise>  
 </c:choose>  
<html:link page="/ProgressReporterForm.jsp">Go Back</html:link>   
</body>   
</html:html> 

及其调用的对象的数组列表。我有 AggregateBatchProgressMetrics。在 AggregateBatchProgressMetrics 内部,我有一个名为 getBatchMetricsList 的方法,它返回一个名为 BatchProgressMetrics 的对象的数组列表。如果我在没有嵌套的 c:forEach 标签的情况下运行它,它会运行得很好,但如果我包含嵌套的标签,它就会失败。有人可以帮我吗?

提前致谢。 阿尔马斯

I am getting

org.apache.jasper.JasperException: /WEB-INF/AllClientBatchDetails.jsp(54,103) equal symbol expected

And here is the jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*%>   
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>   
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>   
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  


<html:html xhtml="true">   
<head>   
<title><bean:message key="progressReporter.successpage.title"/></title>  
<link rel="stylesheet" href="style.css">    
<html:base/>   
</head>   
<body>  
 <c:choose>   
  <c:when test="${empty batchProgressMetricsList}">  
   <font color=<bean:message key="error.font.color" />   size=<bean:message key="error.font.size" />>  
     <bean:message key="error.no.active.batch" />  
   </font>  
   <br/>  
  </c:when>  
  <c:otherwise>  
   <h4><bean:message key="table.header" /></h4>  
   <table border=<bean:message key="table.border.size" />>  
    <tr>  
     <th><bean:message  key="table.client.id.header" /></th>  
     <th><bean:message key="table.total.session.used" /></th>  
     <th><bean:message key="table.total.time.elapsed" /></th>  
     <th><bean:message key="table.imnts.completed" /></th>  
     <th><bean:message key="table.imnts.remaining" /></th>  
     <th><bean:message key="table.cores.allocated" /></th>  
     <th><bean:message key="table.time.remaining" /></th>  
    </tr>  
    <c:forEach var="aggregatedBatchProgressMetrics" items="${batchProgressMetricsList}">  
     <tr>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["clientId"]}</td>        
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["sessionUsedTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["sessionUsedTime"] % 60000)/1000, '.')}secs </td>  
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["totalElapsedTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["totalElapsedTime"] % 60000)/1000, '.')}secs</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsCompleted"]}</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsRemaining"]}</td>  
      <td class="tdcenter">${aggregatedBatchProgressMetrics["numberOfCores"]}</td>  
      <td class="tdcenter">${fn:substringBefore(aggregatedBatchProgressMetrics["sessionStats"]["sessionRemainingTime"]/60000, '.')}mins${fn:substringBefore((aggregatedBatchProgressMetrics["sessionStats"]["sessionRemainingTime"] % 60000)/1000, '.')}secs</td>  
      <br/>  
       <table>  
        <tr>  
         <th>session Id</th>  
         <th>taskId</th>  
         <th>task start time</th>  
         <th>task end time</th>  
        </tr>        
        ${aggregatedBatchProgressMetrics["batchMetricsList"][0]}  
        ${aggregatedBatchProgressMetrics["batchMetricsList"][1]}  
        ${aggregatedBatchProgressMetrics["batchMetricsList"][2]}  

        <c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics["batchMetricsList"]}">  
         <tr>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["sessionId"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskId"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskStartTime"]}</td>  
          <td class="tdcenter">${batchProgressMetrics["taskStats"]["taskEndTime"]}</td>  
         </tr>  
        </c:forEach>          
       </table>  
      <br/>  
     </tr>  
    </c:forEach>  
   </table>  
  </c:otherwise>  
 </c:choose>  
<html:link page="/ProgressReporterForm.jsp">Go Back</html:link>   
</body>   
</html:html> 

I have request attribute set to batchProgressMetricsList and its an array list of an object called. I have AggregatedBatchProgressMetrics. Inside aggregatedBatchProgressMetrics i have a method called getBatchMetricsList which return an arraylist of object called BatchProgressMetrics. If i run it without the nested c:forEach tag, it would just run fine, but if i include the nested one it just fails. Can somebody please help me?

Thanks in advance.
Almas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

惯饮孤独 2024-10-13 23:37:11

尝试将其更改

items="${aggregatedBatchProgressMetrics["batchMetricsList"]}"

为:

items="${aggregatedBatchProgressMetrics['batchMetricsList']}"

Try changing this:

items="${aggregatedBatchProgressMetrics["batchMetricsList"]}"

to this:

items="${aggregatedBatchProgressMetrics['batchMetricsList']}"
夜深人未静 2024-10-13 23:37:11

替换

<c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics["batchMetricsList"]}"> 

<c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics['batchMetricsList']}">  

双引号过早关闭 items 值,导致 EL 无效。当使用具有良好 sytnax 突出显示功能的编辑器时,您应该很快就发现了这一点(就像这里的 SO :) )。

Replace

<c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics["batchMetricsList"]}"> 

by

<c:forEach var="batchProgressMetrics" items="${aggregatedBatchProgressMetrics['batchMetricsList']}">  

The doublequote was closing the items value too soon which resulted in invalid EL. You should have spotted this soon enough when using an editor with decent sytnax highlighting (like here on SO :) ).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文