辅导:Warning:Superclassdoesnotexist.错误解决方法
来源:优易学  2011-11-9 13:42:53   【优易学:中国教育考试门户网】   资料下载   IT书店
  1. 在Myeclipse 的stuts-config.xml里的design模式下点右键创建 Form,Action and JSP 的时候,出现:Warning: Superclass does not exist.
  答:把struts.jar在重新引入到工程目录下
  2. 创建数据库连接
  Connection conn = null;// 数据库连接
  Statement stmt = null;// 数据库表达式
  ResultSet rs = null;// 结果集
  try {
  Class.forName(driver);
  } catch (ClassNotFoundException e) {
  e.printStackTrace();
  }// sql 的驱动
  try {
  conn = java.sql.DriverManager.getConnection(url,username,password);
  } catch (SQLException e) {
  e.printStackTrace();
  }
  3. 数据操作
  stmt = conn.createStatement();
  // 执行插入数据的 SQL
  int row = stmt.executeUpdate("insert into……");
  rs = stmt.executeQuery("select * from Student");
  while (rs.next()) {
  System.out.println("编号=" + rs.getInt(1));
  System.out.println("学生姓名=" +rs.getString("username"));
  System.out.println("密码=" + rs.getString("password"));
  System.out.println("年龄=" + rs.getString("age"));
  }
  // 执行删除数据的 SQL, 被删除的记录的ID为7
  row = stmt.executeUpdate("delete from student where id = 7");
  System.out.println("删除了 " + row);
  4. 关闭
  try {
  rs.close();
  }
  catch (SQLException e){
  }
  try {
  stmt.close();
  }
  catch (SQLException e){
  }
  try {
  conn.close();
  }
  catch (SQLException e) {
  }
  5. Activation.main: 警告: sun.rmi.activation.execPolicy 系统属性未被指定且 ExecPermissions/ExecOptionPermissions均未被授权。青年人网站提示随后的激活尝试失败,原因是对ExecPermission/ExecOptionPermission 的权限检查失败。
  有关如何配置 rmid 安全性的文档说明,请参阅: http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/rmid.html
  http://java.sun.com/j2se/1.4/docs/tooldocs/win32/rmid.html
  原因:main函数未指定;运行时,可以选择该函数,右键运行

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训