jsp报错:Syntax error, insert "Finally" to complete TryStatement 在jsp中出现:Syntax error, insert "Finally" to complete TryStatement错误怎么办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 页面如下:<html xmlns="http://www.w3.org/1999/xhtml"><head> <title>主题列表</title> <%@ include file="/WEB-INF/pages/public/commons.jspf" %></head><body><!--===================主题列表==================--><div class="area_articlelist"> <%--主题列表分页信息--%> <%@ include file="/WEB-INF/pages/public/pageview.jspf" %> <ul> <%--本页主题列表--%> <c:forEach items="${request_pageView.recordList}" var="topic"> <li class="${topic.type }">◆ <span style="color:#8a2be2"><html:link action="/topic?method=show&id=${topic.id}&pageNum=1" target="right">【${topic.type}】<c:out value="${topic.title}"/></html:link></span> (${topic.replyCount}回复) </li> </c:forEach> </ul> <%--主题列表分页信息--%> <%@ include file="/WEB-INF/pages/public/pageview.jspf" %></div></body></html> 在倒数第三行:<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>报错:Syntax error, insert "Finally" to complete TryStatement如果去掉head中的<%@ include file="/WEB-INF/pages/public/commons.jspf" %>怎没有错了。 报:Syntax error, insert "Finally" to complete TryStatement <%@ include file="/WEB-INF/pages/public/pageview.jspf" %>说明你这个文件里面有错误。把代码贴出来 你的try-catch-finally没写全估计只有try一个光杆司令或者是你的jsp包含很乱。少了花括号之类 <%@ include file="/WEB-INF/pages/public/pageview.jspf" %>说明你这个文件里面有错误。把代码贴出来 pageview.jspf如下:<%@ page pageEncoding="utf-8" language="java" %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><c:if test="${request_pageView.totalPage gt 1}"><div class="pageview">分页: <%--页码列表--%> <a href="javascript:gotoPage(1)">[首页]</a> <c:forEach begin="${request_pageView.startPageIndex}" end="${request_pageView.endPageIndex}" var="pageNum"> <c:if test="${request_pageView.currentPage ne pageNum}"> <a href="javascript:gotoPage(${pageNum})">[${pageNum}]</a> </c:if> <c:if test="${request_pageView.currentPage eq pageNum}"> <span class="currentpage">[${pageNum}]</span> </c:if> </c:forEach> <a href="javascript:gotoPage(${request_pageView.totalPage})">[尾页]</a> <%--快速选择页码--%> <select name="pageNum" onchange="gotoPage(this.value)"> <c:forEach begin="1" end="${request_pageView.totalPage}" var="pageNum"> <option value="${pageNum}" ${request_pageView.currentPage eq pageNum ? 'selected=\\"selected\\"' : ''}>${pageNum}</option> </c:forEach> </select></div><script type="text/javascript"> function gotoPage(pageNum) { if (isNaN(pageNum)) { alert("请输入正确的页码"); document.getElementById('txtPageNum').focus(); return; } if (pageNum < 1 || pageNum > ${request_pageView.totalPage}) { alert("请输入正确的页码,页码范围为 1-11"); document.getElementById('txtPageNum').focus(); return; } document.location.href = getPageViewUrl(pageNum); }</script></c:if> 看看生成好的JAVA文件是啥样的.. 我觉的跟pageview.jspf没有关系,因为我把它里面的代码注释掉了,还是报这个错误。问题是否在原页面呢? 为什么在原页面中去掉head中的<%@ include file="/WEB-INF/pages/public/commons.jspf" %>就没有错了呢? 我感到奇怪的是:我写了两个<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>第一个没问题,为什么第二个会报错呢? JSONObject无法完成实例化。。。。 关于Spring 的 两个AOP编程问题。讨论会受益哦~大家来讨论下吧~~~ 史上最牛集群,绝对雷倒你,大虾们进 flashpaper如何将多个pdf文件批量转成swf文件 关于从隐藏按钮取值问题 JSP如何实现关闭多个页面后,使session失效? SQL递归查询-——java.lang.StackOverflowError,求解! 有关汉字显示乱码问题? 怎么样才能实现这个循环?高分请教!!! 求解:Class 文件找不到 java.lang.NullPointerException java网站中文转化问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>主题列表</title>
<%@ include file="/WEB-INF/pages/public/commons.jspf" %></head>
<body><!--===================主题列表==================-->
<div class="area_articlelist">
<%--主题列表分页信息--%>
<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>
<ul>
<%--本页主题列表--%>
<c:forEach items="${request_pageView.recordList}" var="topic">
<li class="${topic.type }">◆ <span style="color:#8a2be2"><html:link
action="/topic?method=show&id=${topic.id}&pageNum=1"
target="right">【${topic.type}】<c:out value="${topic.title}"/></html:link></span>
(${topic.replyCount}回复)
</li>
</c:forEach>
</ul>
<%--主题列表分页信息--%>
<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>
</div>
</body>
</html>
报错:Syntax error, insert "Finally" to complete TryStatement
如果去掉head中的<%@ include file="/WEB-INF/pages/public/commons.jspf" %>
怎没有错了。
说明你这个文件里面有错误。把代码贴出来
估计只有try一个光杆司令或者是你的jsp包含很乱。少了花括号之类
<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>
说明你这个文件里面有错误。把代码贴出来
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><c:if test="${request_pageView.totalPage gt 1}">
<div class="pageview">分页:
<%--页码列表--%>
<a href="javascript:gotoPage(1)">[首页]</a>
<c:forEach begin="${request_pageView.startPageIndex}" end="${request_pageView.endPageIndex}" var="pageNum">
<c:if test="${request_pageView.currentPage ne pageNum}">
<a href="javascript:gotoPage(${pageNum})">[${pageNum}]</a>
</c:if>
<c:if test="${request_pageView.currentPage eq pageNum}">
<span class="currentpage">[${pageNum}]</span>
</c:if>
</c:forEach>
<a href="javascript:gotoPage(${request_pageView.totalPage})">[尾页]</a>
<%--快速选择页码--%>
<select name="pageNum" onchange="gotoPage(this.value)">
<c:forEach begin="1" end="${request_pageView.totalPage}" var="pageNum">
<option value="${pageNum}" ${request_pageView.currentPage eq pageNum ? 'selected=\\"selected\\"' : ''}>${pageNum}</option>
</c:forEach>
</select>
</div><script type="text/javascript">
function gotoPage(pageNum) {
if (isNaN(pageNum)) {
alert("请输入正确的页码");
document.getElementById('txtPageNum').focus();
return;
}
if (pageNum < 1 || pageNum > ${request_pageView.totalPage}) {
alert("请输入正确的页码,页码范围为 1-11");
document.getElementById('txtPageNum').focus();
return;
}
document.location.href = getPageViewUrl(pageNum);
}
</script>
</c:if>
看看生成好的JAVA文件是啥样的..
因为我把它里面的代码注释掉了,还是报这个错误。
问题是否在原页面呢?
就没有错了呢?
<%@ include file="/WEB-INF/pages/public/pageview.jspf" %>
第一个没问题,为什么第二个会报错呢?