请问高手提交表单Ecplice中出 :Source not found for Class.getDeclaredConstructors0(boolean) line: not available [native method] 的意思???谢了!

A19850925 2008-04-03 08:03:31
交表单Ecplice中出 :Source not found for Class<T>.getDeclaredConstructors0(boolean) line: not available [native method] 的意思???谢了!
...全文
1851 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
guoyuewmall 2010-12-29
  • 打赏
  • 举报
回复
把所有断点去掉就行了
F404769510 2010-11-07
  • 打赏
  • 举报
回复
Source not found for MemoryUserDatabase.save() line 502
kuangren987 2009-12-29
  • 打赏
  • 举报
回复
关注,我也遇到这种情况了,还没解决,如果你知道原因请告诉我一下,我QQ1061500320谢谢
A19850925 2008-04-03
  • 打赏
  • 举报
回复
我刚下课,是初次用Ecplise,难道是我配置的问题?
我现在又运行一次,结果又出现了:Source not found for ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 307
moodoasis 2008-04-03
  • 打赏
  • 举报
回复
啊,表单提交阿,sorry,刚才,没细看
moodoasis 2008-04-03
  • 打赏
  • 举报
回复
lz点什么时候,出的error啊,我跑你的code,并没有出现你说的error,可是,奇怪的是,点个link到GetMessage 的时候,没有出现页面,而是出现了下载对话框,出现它倒是合理,但感觉,不出现也合理啊,我迷糊了
A19850925 2008-04-03
  • 打赏
  • 举报
回复
真是谢谢了!!!!!!!
光辉岁月 2008-04-03
  • 打赏
  • 举报
回复
先mark下
代码这么长,现在上班了,我中午下班休息的时候给你看看,尽力帮。
A19850925 2008-04-03
  • 打赏
  • 举报
回复
message.java
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import java.text.SimpleDateFormat;

public class message extends HttpServlet {



public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request, response);
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:message";
response.setContentType("text/html charset=utf-8");
PrintWriter out = response.getWriter();
Connection con;
int s=0;
String sql = "insert into TABLE1 (name,phone,email,title,content,time) values (?,?,?,?,?,?)";
String name = request.getParameter("name");
String title = request.getParameter("title");


out.println("<html>");
out.println("<title><head>add message</head></title>");
out.println("<body>");


if (StringUTL.validateNull(title)) {
out.println("<h1 color='red'>对不起,标题不能为空,请重新输入;</h1>");
out.println("<a href='/servlet/getMessage'请重新输入返回地址</a><br>");

}
if (StringUTL.validateNull(name)) {
out.println("<h1 color='red'>对不起,姓名不能为空,请重新输入;</h1>");
out.println("<a href='/guestbook/message'>请重新输入返回地址</a><br>");
} else {
try {
Class.forName(driver);
con = DriverManager.getConnection(url);
PreparedStatement pst = con.prepareStatement(sql);
request.setCharacterEncoding("UTF-8");

pst.setString(1, StringUTL.filterHtml(name));
pst.setString(2, StringUTL.filterHtml(request
.getParameter("telphone")));
pst.setString(3, StringUTL.filterHtml(request
.getParameter("email")));

SimpleDateFormat sft = new SimpleDateFormat(
"YYYY-MM-dd hh:mm:ss");
pst.setString(6, sft.format(new java.util.Date()));
pst.setString(5, request.getParameter("content"));
pst.setString(4, StringUTL.filterHtml(title));
s = pst.executeUpdate();

out.println("</body>");
out.println("</html>");
pst.close();
con.close();

out.flush();
out.close();
} catch (ClassNotFoundException e) {

e.printStackTrace();
} catch (SQLException e) {

e.printStackTrace();
}
if (s == 0) {
out.println("<h1 color='red'>对不起,留言不能成功添加,;</h1>");
out
.println("<a href='/guestbook/message'>返还可以断续添加</a><br>");
} else {
out.println("<h1 color='red'>祝贺你,添加成功,你还想添加留言吗???</h1>");
out
.println("<a href='/guestbook/getMessage'>可以读取留言内容</a><br>");
}

}

}

}
getMessage.java
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;

public class getMessage extends HttpServlet {


public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html charset=utf-8");
PrintWriter out = response.getWriter();
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc,odbc.message";
Connection con;
PreparedStatement pst;
ResultSet rs;
out.println("<html>");
out.println("<title><head>display message</head></title>");
out.println("<body>");
out.println("<a href='/guestbook/servlet/message'>添加留言</a></br>");
out.println("</body>");
try {
Class.forName(driver);
con = DriverManager.getConnection(url);
pst = con.prepareStatement("select*from TABLE1");
rs=pst.executeQuery();
while(rs.next()){
printOut(out,rs);

}
rs.close();
pst.close();
con.close();
} catch (ClassNotFoundException e) {

e.printStackTrace();
}catch (SQLException e) {

e.printStackTrace();
}



out.flush();
out.close();
}

public void printOut(PrintWriter out,ResultSet rs)throws SQLException{
out.println("<table border='1' width='600'>");
out.println("<tr><td width='500'>编号:</td>");
out.println("<td>"+rs.getInt(1)+"</td>");
out.println("<tr><td width='500'>姓名:</td>");
out.println("<td>"+rs.getString(2)+"</td>");
out.println("<tr><td width='500'>电话:</td>");
out.println("<td>"+StringUTL.changNull(rs.getString(3), "未填写")+"</td>");
out.println("<tr><td width='500'>email:</td>");
out.println("<td>"+rs.getString(4)+"</td>");
out.println("<tr><td width='500'>标题:</td>");
out.println("<td>"+rs.getString(5)+"</td>");
out.println("<tr><td width='500'>内容:</td>");
out.println("<td>"+rs.getString(6)+"</td>");
out.println("<tr><td width='500'>时间:</td>");
out.println("</table>");
}


}
StringUTL.java
public class StringUTL {
// 验证字符串内容为空
public static boolean validateNull(String args) {
if (args == null || args.length() == 0||args.equalsIgnoreCase("null")) {
return true;
} else {
return false;
}
}

// 判断第一个参数是否为空
public static String changNull(String source, String target) {
if (source == null || source.length() == 0) {
return target;
} else {
return source;
}

}
//对HTML代码进行过滤
public static String filterHtml(String input) {
if (input == null) {
return null;
}
if (input.length() == 0) {
return input;
}
input.replaceAll("&", "&");
input.replaceAll("<", "<");
input.replaceAll(">", "gt;");
input.replaceAll(" ", "nbsp;");
input.replaceAll("\"", "&39;");
input.replaceAll("\n", "quot;");
return input;
}
}
A19850925 2008-04-03
  • 打赏
  • 举报
回复
谢谢了!!!!!
光辉岁月 2008-04-03
  • 打赏
  • 举报
回复
好像是类中无改方法,最好是贴出源码看看,经验不多。
A19850925 2008-04-03
  • 打赏
  • 举报
回复
Message.htm
<!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>
<script src="/guestbook/fckeditor/fckeditor.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: x-large;
color: #FF0000;
}
-->
</style>


</head>

<body>
<form id="form1" name="form1" method="post"
action="/guestbook/servlet/message"
>
<table width="602" border="0">
<tr>
<td colspan="2">
<div align="center" class="STYLE1">
留言板
</div>
</td>
</tr>
<tr>
<td width="126">
姓名:
</td>
<td width="485">
<label>
<input name="name" type="text" id="name" size="40" />
</label>
</td>
</tr>
<tr>
<td>
email:
</td>
<td>
<label>
<input name="email" type="text" id="email" size="40" />
</label>
</td>
</tr>
<tr>
<td>
电话:
</td>
<td>
<label>
<input name="telphone" type="text" id="telphone" size="40" />

</label>
</td>
</tr>
<tr>
<td>
主题:
</td>
<td>
  
<label>

<input name="title" type="text" id="telphone" size="40" />


</label>
</td>
</tr>
<tr>
<td>
内容:
</td>
<td>
<label>
<script>
var edtior=new FCKeditor('content');
edtior.BasePath='/guestbook/fckeditor/';
edtior.ToolbarSet='Basic';
edtior.Create();

</script>

</label>
</td>
</tr>
<tr>
<td>
<label>

<div align="left">
<input type="submit" name="Submit" value="提交" />
</div>
</label>
</td>
<td>
<label>

<div align="left">
<input type="reset" name="Submit2" value="重置" />
</div>
</label>
</td>
</tr>
<tr>
<td>
 
</td>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
<td>
 
</td>
</tr>
</table>
</form>
</body>
</html>



web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>message</servlet-name>
<servlet-class>message</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>getMessage</servlet-name>
<servlet-class>getMessage</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>message</servlet-name>
<url-pattern>/servlet/message</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>getMessage</servlet-name>
<url-pattern>/servlet/getMessage</url-pattern>
</servlet-mapping>
</web-app>
麻烦了,小妹不知怎么感谢你了!!!!!!
光辉岁月 2008-04-03
  • 打赏
  • 举报
回复
我看了你的程序,本想给调试下,可是看了下,你只给核心的代码,无法给你调试。
上面的代码没异常的地方,估计看看是不是其他的代码错了
Source not found for ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 307
应该是过滤器代码有错误
A19850925 2008-04-03
  • 打赏
  • 举报
回复
晕死了!我是初学者,
双击Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]
会出现Class.class 类,是不是我的配置问题????
忙繁你告诉我一声!!!!

81,115

社区成员

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

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