org.apache.jasper.JasperException: 这是个什么错误!!!

BUG胡汉三
博客专家认证
2011-08-31 12:54:03
Action类代码!这个List绝对有值。

public String queryQuestion(){
try{
String wheres = request.getParameter("wheres"); //类型
String whereName = request.getParameter("whereName"); //条件
List<Tbquestion> list = question.queryTbquestion(wheres, whereName,getMeetingAll());
request.setAttribute("listQues", list);
}catch(Exception ex){
ex.printStackTrace();
}
return SUCCESS;
}

Struts2配置:

<action name="questionAction" class="questionAction">
<result name="success">/jsppages/visit/question/index.jsp</result>
</action>

JSP页面代码:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="paging" uri="/WEB-INF/userTag/paging-tag.tld"%>
<%
String path = request.getContextPath();
pageContext.setAttribute("path",path);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
下面只贴重要部分:
<c:forEach items="${listQues}" var="questionList" varStatus="indexNum">
<tr onclick="clickInfo('${questionList.qid}','<%=path %>/platform/questionAction!queryTbquestionById.action');" id="tr${indexNum.index}">
<td><input type="checkbox" name="cheAll" id="${questionList.qid}"/></td>
<td>${questionList.title}</td>
<td>${questionList.clientname}</td>
<td>${questionList.newtime}</td>
<td>${questionList.status}</td>
<td>
<a href="#"> 变更</a>-
<a href="#"> 编辑</a>
</td>
</tr>
</c:forEach>

异常信息在下面~~~!!!

这是个什么错误啊???
...全文
66386 27 打赏 收藏 转发到动态 举报
写回复
用AI写文章
27 条回复
切换为时间正序
请发表友善的回复…
发表回复
aakzhangliangming 2013-12-09
  • 打赏
  • 举报
回复
我也遇到这种情况,我也不清楚是什么问题,我是从网上copy一些代码过来的,所以在""方面就有问题,所以我自己重新手写上去 就没有问题了。
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复

12:18:49,171 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c in /jsppages/visit/question/index.jsp</h3><p>null: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the CDATA section.</p>
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:74)
at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1795)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1741)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


后面太多了、就不贴出来了!!!
昨天这个页面还好好的~~~今天怎么说变就给变了呢!!!
罗道人 2011-08-31
  • 打赏
  • 举报
回复
死妖孽,说你是编码问题你还不信。。。硬要在哪里找标签的错。。。
huyajielovexiao 2011-08-31
  • 打赏
  • 举报
回复
id="tr${indexNum.index}"
这个有问题
lcl_account 2011-08-31
  • 打赏
  • 举报
回复
你试试把所有的c都换成struts2 的标签 struts2的标签就够你使用了 以前我用c 现在都忘的差不多了
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复

我觉得我可以向老板申请好人卡了!!!
昨天这个页面没有问题!
今天一访问、就报错!
然后我就新建一个页面、把报错的这个页面的东西放到一个新建的页面去!
访问这个新建的页面!
但还是他妈的一样的错误!!!
..........
有同学说是C标签问题!
我又从新搞了个页面、只把表格部分粘帖了过来!
重启一下JBoss、访问新建的这个页面、它娘的、在这边乖乖的显示了、!
然后在慢慢的把报错页面的所有东西粘帖过来!
直到除了页面名称不同以外、其他的都一样、结果还是没有错误!!!
太他妈奇怪了、我仔细一看、确实有一部分是不相同的!
我贴出来!
报错页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户问题跟踪管理</title>
</head>

新建页面:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'MyJsp.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>

除了这里其它的都一样!!!
于是我就用新建页面的这部分不同内容覆盖报错页面的内容、在来访问报错页面、结果不愧是报错页面、果然还是错的!
我不甘心了、然后一个Ctrl+A新建页面、把它整个的覆盖报错页面、在来访问报错页面、!
也许是占了新建页面的新鲜血液、狗日的既然就不错了!!!
他娘的、这不是瞎折腾吗!!!
伤不起啊、有木有!!!
qianyecq 2011-08-31
  • 打赏
  • 举报
回复

<div class="page" style="position:relative;">
<span style="position: absolute; right: 25px;"> <paging:page
file="${path}/platform/questionAction!queryQuestion.action"
pageInfo="${requestScope.pageInfo}" /> </span>
</div>
这个也改一下:
div class="page" style="position:relative;">
<span style="position: absolute; right: 25px;"> <paging:page
file="<%=path %>/platform/questionAction!queryQuestion.action"
pageInfo="${requestScope.pageInfo}" /> </span>
softroad 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 softroad 的回复:]

An invalid XML character (Unicode: 0x0) was found in the CDATA section
检查下你的数据是否包含非法字符了。
[/Quote]

有的特殊字符不是肉眼能看出来的。
qianyecq 2011-08-31
  • 打赏
  • 举报
回复


<form name="Myform1" id="Myform1" action="${path}/platform/questionAction!queryQuestion.action" method="post">
改为:
<form name="Myform1" id="Myform1" action="<%=path %>/platform/questionAction!queryQuestion.action" method="post">
这样试试。
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
这个页面确实有问题~~~大家帮忙找找!!!
我从新整一个页面专门用来显示数据、没有错误的!!!
看来就是这个页面的问题了!
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 qianyecq 的回复:]

最好整个页面的代码都贴出来看看。
[/Quote]
好的!!!


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="paging" uri="/WEB-INF/userTag/paging-tag.tld"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
pageContext.setAttribute("path",path);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户问题跟踪管理</title>
<link href="<%=path %>/jsppages/visit/css/style.css" rel="stylesheet" type="text/css" />
<script src="<%=path %>/jsppages/visit/js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="<%=path %>/jsppages/visit/js/tab.js" type="text/javascript"></script>
<script src="<%=path %>/js/commonJs.js" type="text/javascript"></script>
<script type="text/javascript">
/*
* 跳转到详情Action
* @param {Object} Id:当前数据Id
* @param {Object} url:Action路径
*/
function clickInfo(Id,url){
document.getElementById('ifame1').src = url+"?Id="+Id;
}
</script>
</head>
<body>
<form name="Myform1" id="Myform1" action="${path}/platform/questionAction!queryQuestion.action" method="post">
<div class="main">
<div class="title">
<div class="title_content">客户问题跟踪管理</div>
</div>
<div class="form">
<ul>
<li>
<select name="wheres" >
<option value="">----请选择----</option>
<option value="title">反馈标题</option>
<option value="clientname">客户姓名</option>
<option value="newtime">反馈时间</option>
</select>
<input type="text" name="whereName" />
<input type="button" value="查询" class="xbtn" />
</li>
</ul>
<div style="float:right; display:inline; margin:0; padding:0">
<input type="button" value="新增" class="xbtn" onclick="javascript:(location.href='add_question.html')" />
<input type="button" value="导出" class="xbtn" />
<input type="button" value="删除" class="xbtn" onclick="deleteInfo();" />
</div>
</div>
<table id="mytable">
<thead>
<tr>
<td><input type="checkbox" name="chePub" onclick="selAll(this,'cheAll');">全选</td>
<td>反馈标题</td>
<td>客户姓名</td>
<td>反馈时间</td>
<td>当前状态</td>
<td>操作</td>
</tr>
</thead>
<%--onclick="clickInfo('${questionList.qid}','<%=path %>/platform/questionAction!queryTbquestionById.action');" --%>
<tbody>
<%--
<s:iterator id="listQues" var="list">
<tr id="tr">
<td><input type="checkbox" name="cheAll" id="#list.qid"/></td>
<td><s:property value="#list.title" /></td>
<td><s:property value="#list.clientname" /></td>
<td><s:property value="#list.newtime" /></td>
<td><s:property value="#list.status" /></td>
<td>
<a href="#"> 变更</a>-
<a href="#"> 编辑</a>
</td>
</tr>
</s:iterator>
--%>

<c:forEach items="${listQues}" var="quesBean" varStatus="indexNum">
<tr id="tr${indexNum.index}">
<td><input type="checkbox" name="cheAll" id="${quesBean.qid}"/></td>
<td>${quesBean.title}</td>
<td>${quesBean.clientname}</td>
<td>${quesBean.newtime}</td>
<td>${quesBean.status}</td>
<td>
<a href="#"> 变更</a>-
<a href="#"> 编辑</a>
</td>
</tr>
</c:forEach>

</tbody>
</table>
<div class="page" style="position:relative;">
<span style="position: absolute; right: 25px;"> <paging:page
file="${path}/platform/questionAction!queryQuestion.action"
pageInfo="${requestScope.pageInfo}" /> </span>
</div>
<iframe id="ifame1" name="dexInfo" width="100%" height="100%"
scrolling="auto" marginwidth="0" frameborder="0" >
</iframe>
<script type="text/javascript">
$("#tr0").addClass("selected");
$("table tbody tr").each(function(i){
$(this).click(function(){
$("table tbody tr").each(function(j){
$(this).removeClass("selected");
});
$(this).addClass("selected");
});
$(this).blur();
});
$("#tr0").click();
$("#tr0").addClass("selected");
</script>
</div>
</form>
<script language="javascript" src="<%=path %>/jsppages/visit/js/table.js"></script>
</body>
</html>
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
13:57:36,562 INFO [STDOUT] 7
13:57:36,562 INFO [STDOUT] 2011-08-30
13:57:36,562 INFO [STDOUT] 梁羽生
13:57:36,562 INFO [STDOUT] 不得已
13:57:36,562 INFO [STDOUT] 4
13:57:36,562 INFO [STDOUT] 8
13:57:36,562 INFO [STDOUT] 2011-08-30
13:57:36,562 INFO [STDOUT] 古龙
13:57:36,562 INFO [STDOUT] 东方不败
13:57:36,562 INFO [STDOUT] 3
13:57:36,562 INFO [STDOUT] 9
13:57:36,562 INFO [STDOUT] 2011-08-30
13:57:36,562 INFO [STDOUT] 金庸
13:57:36,562 INFO [STDOUT] 风云再起
13:57:36,562 INFO [STDOUT] 2
这样的数据也会有问题???

for (Tbquestion t : list) {
System.out.println(t.getQid());
System.out.println(t.getNewtime());
System.out.println(t.getClientname());
System.out.println(t.getTitle());
System.out.println(t.getStatus());
}
qianyecq 2011-08-31
  • 打赏
  • 举报
回复
最好整个页面的代码都贴出来看看。
qianyecq 2011-08-31
  • 打赏
  • 举报
回复
加个判断试一下


<c:if test="${null != listQues}">
<c:forEach items="${listQues}" var="questionList" varStatus="indexNum">
<tr onclick="clickInfo('${questionList.qid}','<%=path %>/platform/questionAction!queryTbquestionById.action');" id="tr${indexNum.index}">
<td><input type="checkbox" name="cheAll" id="${questionList.qid}"/></td>
<td>${questionList.title}</td>
<td>${questionList.clientname}</td>
<td>${questionList.newtime}</td>
<td>${questionList.status}</td>
<td>
<a href="#"> 变更</a>-
<a href="#"> 编辑</a>
</td>
</tr>
</c:forEach>
</c:if>

还有仔细检查页面的其他地方看看是不是有问题。
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 lcl_account 的回复:]

建议你使用struts2 自己的标签

用<s:iterator id="listQues" var="list">
<s:property value="#list.title">
</s:iterator>
这个一般不会有问题
[/Quote]


<s:iterator id="listQues" var="list">
<tr id="tr">
<td><input type="checkbox" name="cheAll" id="#list.qid"/></td>
<td><s:property value="#list.title" /></td>
<td><s:property value="#list.clientname" /></td>
<td><s:property value="#list.newtime" /></td>
<td><s:property value="#list.status" /></td>
<td>
<a href="#"> 变更</a>-
<a href="#"> 编辑</a>
</td>
</tr>
</s:iterator>

还是一样的错误~~~!!!org.apache.jasper.JasperException:后面的也一模一样!!!
变都不带变的!!!
YeHuai1991 2011-08-31
  • 打赏
  • 举报
回复
<c:forEach items="${request.getAttribute("listQues")}" var="questionList" varStatus="indexNum">
lcl_account 2011-08-31
  • 打赏
  • 举报
回复
建议你使用struts2 自己的标签

用<s:iterator id="listQues" var="list">
<s:property value="#list.title">
</s:iterator>
这个一般不会有问题
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 leehomwong 的回复:]

是XML里面有编码不一样的字符吧~
[/Quote]
所有的字符编码的是UTF-8!!!
24K純帥 2011-08-31
  • 打赏
  • 举报
回复
是XML里面有编码不一样的字符吧~
BUG胡汉三 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 kafeixiangcha 的回复:]

死妖孽不理我。。。

错误报的很明显。

编码异常,导致C标签不能正常运作。

去看下你的值里面有没有什么特别的东西吧
[/Quote]

道长啊~~~这个数据我都改来改去了!!!
数据库里面的数据都删得只有8条了!
我手动录入了、连空的都给设值了、!
加载更多回复(7)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧