myeclipse中的debug模式里面的step in和step out键是灰的,我没有做什么设置,现在jsp文件出现了异常,在与数据库取内容的时候,所有文件都不报错,但是ie上面看不到数据库里面的内容,但后台能看见,因此我想单步调试,第一次做项目,很多问题不懂,希望高手指点
解决方案 »
- hibernate+spring 总是报空指针的错误。nullpointer
- 求各位高手帮助解决JSP上传文件错误
- Servlet生命周期
- 求精通Spring2.x-企业应用开发详解 电子书
- 2008,给自己一个好前程
- 【急】java Struts2 根据文件路径可以上传附件吗?
- 什么情况下会出现这样的错误:java.net.SocketException??
- 请过来人指点[在线等]
- 我的 weblogic7.2 URL路径有问题
- jboss下部署servlet的问题,请大家指教!
- JPA:@embeddable中指定序列为什么不好使
- 急急急!!hibernate发出sql语句出错 列名出错'trade0_.accountID_accountID'
<%@ page language="java" import="java.util.*,java.sql.*,com.java.bbs.*,java.io.*" pageEncoding="GB18030"%><%!
private void tree(List<Article> articles,Connection conn,int id,int grade){
String sql = "select * from articles where pid="+id;
Statement stmt = DB.createStmt(conn);
ResultSet rs = DB.executeQuery(stmt,sql);
//if(rs!=null )System.out.println("------");
try{
while(rs.next()){
Article a = new Article();
a.initFormRS(rs);
a.setGrade(grade);
articles.add(a);
if(a.isLeaf){
tree(articles,conn,a.getId(),grade+1);
}
System.out.println(a.getPdate());
}
}catch(SQLException e){
e.printStackTrace();
}finally{
DB.close(stmt);
DB.close(rs);
}
}
%>
<%
List<Article> articles = new ArrayList<Article>();
Connection conn = DB.getConn();
tree(articles,conn,0,0);
DB.close(conn);%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Java|Java世界_中文论坛|ChinaJavaWorld技术论坛 : Java语言*初级版</title>
<meta http-equiv="content-type" content="text/html; charset=GBK">
<link rel="stylesheet" type="text/css" href="images/style.css" title="Integrated Styles">
<script language="JavaScript" type="text/javascript" src="images/global.js"></script>
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://bbs.chinajavaworld.com/rss/rssmessages.jspa?forumID=20">
<script language="JavaScript" type="text/javascript" src="images/common.js"></script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="140"><a href="http://bbs.chinajavaworld.com/index.jspa"><img src="images/header-left.gif" alt="Java|Java世界_中文论坛|ChinaJavaWorld技术论坛" border="0"></a></td>
<td><img src="images/header-stretch.gif" alt="" border="0" height="57" width="100%"></td>
<td width="1%"><img src="images/header-right.gif" alt="" border="0"></td>
</tr>
</tbody>
</table>
<br>
<div id="jive-forumpage">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr valign="top">
<td width="98%"><p class="jive-breadcrumbs">论坛: Java语言*初级版
(模仿)</p>
<p class="jive-description"> 探讨Java语言基础知识,基本语法等 大家一起交流 共同提高!谢绝任何形式的广告 </p>
</td>
</tr>
</tbody>
</table>
<div class="jive-buttons">
<table summary="Buttons" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="jive-icon"><a href="post.jsp"><img src="images/post-16x16.gif" alt="发表新主题" border="0" height="16" width="16"></a></td>
<td class="jive-icon-label"><a id="jive-post-thread" href="post.jsp">发表新主题 </a></td>
</tr>
</tbody>
</table>
</div>
<br>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tbody>
<tr valign="top">
<td><span class="nobreak"> 页:
1,316 - <span class="jive-paginator"> [ <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=0&isBest=0">上一页</a> | <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=0&isBest=0" class="">1</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=25&isBest=0" class="jive-current">2</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=50&isBest=0" class="">3</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=75&isBest=0" class="">4</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=100&isBest=0" class="">5</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=125&isBest=0" class="">6</a> | <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&start=50&isBest=0">下一页</a> ] </span> </span> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr valign="top">
<td width="99%"><div class="jive-thread-list">
<div class="jive-table">
<table summary="List of threads" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th class="jive-first" colspan="3"> 主题 </th>
<th class="jive-author"> <nobr> 作者
</nobr> </th>
<th class="jive-view-count"> <nobr> 浏览
</nobr> </th>
<th class="jive-msg-count" nowrap="nowrap"> 回复 </th>
<th class="jive-last" nowrap="nowrap"> 最新帖子 </th>
</tr>
</thead>
<tbody>
<%
for(Iterator<Article> it = articles.iterator();it.hasNext();){
Article a = it.next();
String preStr = "";
for(int i=0;i<a.getGrade();i++){
preStr+="----";
}
%>
<tr class="jive-even">
<td class="jive-first" nowrap="nowrap" width="1%"><div class="jive-bullet"> <img src="images/read-16x16.gif" alt="已读" border="0" height="16" width="16">
<!-- div-->
</div></td>
<td nowrap="nowrap" width="1%">
<a href="delete.jsp?id=<%=a.getId() %>&isLeaf=<%=a.isLeaf %>&pid<%=a.getPid() %>">DEL </a>
</td>
<td class="jive-thread-name" width="95%"><a id="jive-thread-1" href="articleDetail.jsp?id=<%=a.getId() %>">初学java遇一难题!!望大家能帮忙一下 谢谢了</a></td>
<td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs.chinajavaworld.com/profile.jspa?userID=226030">fei870407</a> </span></td>
<td class="jive-view-count" width="1%"> 100</td>
<td class="jive-msg-count" width="1%"> 5</td>
<td class="jive-last" nowrap="nowrap" width="1%"><div class="jive-last-post"> <%=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(a.getPdate()) %> <br>
by: <a href="http://bbs.chinajavaworld.com/thread.jspa?messageID=780182#780182" title="jingjiangjun" style="">Ella »</a> </div></td>
</tr>
<%--
<tr class="jive-odd">
<td class="jive-first" nowrap="nowrap" width="1%"><div class="jive-bullet"> <img src="images/read-16x16.gif" alt="已读" border="0" height="16" width="16">
<!-- div-->
</div></td>
<td nowrap="nowrap" width="1%">
</td>
<td class="jive-thread-name" width="95%"><a id="jive-thread-2" href="http://bbs.chinajavaworld.com/thread.jspa?threadID=744234&tstart=25">请 兄弟们指点下那里 错误,,,</a></td>
<td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs.chinajavaworld.com/profile.jspa?userID=226028">403783154</a> </span></td>
<td class="jive-view-count" width="1%"> 52</td>
<td class="jive-msg-count" width="1%"> 2</td>
<td class="jive-last" nowrap="nowrap" width="1%"><div class="jive-last-post"> 2007-9-13 上午8:40 <br>
by: <a href="http://bbs.chinajavaworld.com/thread.jspa?messageID=780172#780172" title="downing114" style="">downing114 »</a> </div></td>
</tr>
--%>
<%
}
%>
</tbody>
</table>
</div>
</div>
<div class="jive-legend"></div></td>
</tr>
</tbody>
</table>
<br>
<br>
</div>
</body>
</html>
当浏览这个页面的时候,MyEclipse 会启动 Debug 透视图,或Debug 管理器
你发的源代码那么多,没人愿意看啊
<%
List<Article> articles = new ArrayList<Article>();
Connection conn = DB.getConn();
tree(articles,conn,0,0);
DB.close(conn);%>
最可能出错的就是Connection conn = DB.getConn();我把它改成了Connection conn = DB.getConn();
if(conn!=null)System.out.println("----");后台打印了,说明连接没有问题对不对?
有些时候也可能是因为 tomcat 发生了异常