日期:2014-05-17  浏览次数:20999 次

JSTL和EL表达式诡异的问题
以下代码昨天之前一直都正常,代码也未经任何修改,今天开始突然就一直报JSP编译错误,具体是因NumberFormatException导致的编译不过去,我实在懵了,报NumberFormat的地方明明是字符串,怎么它就非要给我转换成数字呢?百思不得其解,特来请假CSDN上的高人
代码如下:



<%@ page language="java"  pageEncoding="utf-8"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<div class="topic">

<div class="floor">
<div class="title">
<h1>
${topic.title}
</h1>
</div>
<div class="floormsg title">
<span class="spt">楼主:<a class="author" href="">${topic.username}</a> </span>
<span class="spt">发表于${topic.pubtime}</span>
<span class="spt">点击:</span>
<span class="red">${viewcount}</span>
<span class="spt">回复:</span>
<span class="red">${replycount}</span>
<span class="spt">
<button id="onlyowner" class="btn">
只看楼主
</button> </span>
            <span class="spt">
            <button id="readsettingbtn" class="btn">
                阅读设置
            </button> </span>
</div>
     <c:if test="${currentpage==1}">
<div class="contentdiv">
  ${topic["content"]}
</div>
     </c:if>
</div>

<c:forEach items="${replyList}" var="reply" varStatus="replyStatus">
<div class="floor">
<div class="floormsg">
<span>作者:<a class="author" href="">${reply.username}</a> </span>
<span class="index"> ${replyStatus.index+startfloor}楼</span>
<span class="pubt">发表于${reply.pubtime}</span>
</div>
<div class="contentdiv">
${reply["content"]}
</div>
<div class="operate">
<a href="" onclick="">引用</a>
<a href="" onclick="">举报</a>
</div>
</div>
</c:forEach>
</div>



org.apache.jasper.JasperException: An exception occurred processing JSP page /bbs/topic/floor.jsp at line 40

37:  <c:forEach items="${replyList}" var="reply" varStatus="replyStatus">
38:  <div class="floor">
39:  <div class="floormsg">
40:  <span>浣滆?锛?a class="author" href="">${reply.username}</a> </span>
41:  <span class="index"> ${replyStatus.index+startfloor}妤?/span>
42:  <span class="pubt">鍙戣〃浜?{reply.pubtime}</span>
43:  </div>



关于s1+= 一和s1=s1+1的区别