我正在尝试在 bean 中创建一个 class 的对象,但资源管理器说还不支持?
i am trying to create an object of a class inside a bean but explorer says not supported yet?
我正在尝试在我的 bean 中调用我的数据库 class 的方法。
我不知道为什么它不起作用。
这在技术上是错误的吗?
单击我想要的保存按钮
1-连接到数据库
2-插入数据..
但我有这个错误
发生错误:
尚不支持。
+ 堆栈跟踪
+ 组件树
+ 作用域变量
我的页面代码
我的豆子
package DC1;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.event.ActionEvent;
@ManagedBean(name = "ctrbean")
public class ctrbean {
public ctrbean() {
}
private String id ;
private String pa;
private String name;
private String rank;
private String father ;
private String dob ;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPa() {
return pa;
}
public void setPa(String pa) {
this.pa = pa;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public String getFather() {
return father;
}
public void setFather(String father) {
this.father = father;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public void insert(ActionEvent ee)
{
avDC1 avd = new avDC1();
avd.connect();
}
}
我的数据库class
package DC1;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.inject.Scope;
public class avDC1 {
public avDC1() {
}
private ResultSet rs ;
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public ResultSet getRs() {
return rs;
}
public void setRs(ResultSet rs) {
this.rs = rs;
}
public void connect()
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your Oracle JDBC Driver?");
e.printStackTrace();
return;
}
try {
connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE", "hr",
"umair");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
public void Searchall(ActionEvent ee)
{
try {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your Oracle JDBC Driver?");
e.printStackTrace();
return;
}
try {
connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE", "hr",
"umair");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
String sql = "SELECT * FROM AVIATION" ;
Statement pdt = connection.createStatement();
// pdt.setString(1,ID );
// pdt.setString(2, panumber);
// pdt.setString(3,name);
// pdt.setString(4, rank);
// pdt.setString(5,father );
// pdt.setString(6, dob);
rs = pdt.executeQuery(sql);
rs.next();
String a = rs.getString("NAME");
connection.close();
} catch (SQLException ex) {
Logger.getLogger(avDC1.class.getName()).log(Level.SEVERE, null, ex);
}
} //end of search-all
}//end of class
这是例外情况:
java.lang.UnsupportedOperationException: Not supported yet.
at DC1.person.<init>(person.java:33)
at DC1.NewClass.<init>(NewClass.java:22)
at DC1.ctrbean.insert(ctrbean.java:76)
DC1.person.java
第 33 行明确抛出一个 UnsupportedOperationException
。也许您或您的同事将其放在那里表明实施尚未完成。否则你应该删除声明
throw new UnsupportedOperationException("Not supported yet");
我正在尝试在我的 bean 中调用我的数据库 class 的方法。
我不知道为什么它不起作用。
这在技术上是错误的吗?
单击我想要的保存按钮
1-连接到数据库
2-插入数据..
但我有这个错误
发生错误:
尚不支持。
+ 堆栈跟踪
+ 组件树
+ 作用域变量
我的页面代码
我的豆子
package DC1;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.event.ActionEvent;
@ManagedBean(name = "ctrbean")
public class ctrbean {
public ctrbean() {
}
private String id ;
private String pa;
private String name;
private String rank;
private String father ;
private String dob ;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPa() {
return pa;
}
public void setPa(String pa) {
this.pa = pa;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public String getFather() {
return father;
}
public void setFather(String father) {
this.father = father;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public void insert(ActionEvent ee)
{
avDC1 avd = new avDC1();
avd.connect();
}
}
我的数据库class
package DC1;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.inject.Scope;
public class avDC1 {
public avDC1() {
}
private ResultSet rs ;
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public ResultSet getRs() {
return rs;
}
public void setRs(ResultSet rs) {
this.rs = rs;
}
public void connect()
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your Oracle JDBC Driver?");
e.printStackTrace();
return;
}
try {
connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE", "hr",
"umair");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
public void Searchall(ActionEvent ee)
{
try {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your Oracle JDBC Driver?");
e.printStackTrace();
return;
}
try {
connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE", "hr",
"umair");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
String sql = "SELECT * FROM AVIATION" ;
Statement pdt = connection.createStatement();
// pdt.setString(1,ID );
// pdt.setString(2, panumber);
// pdt.setString(3,name);
// pdt.setString(4, rank);
// pdt.setString(5,father );
// pdt.setString(6, dob);
rs = pdt.executeQuery(sql);
rs.next();
String a = rs.getString("NAME");
connection.close();
} catch (SQLException ex) {
Logger.getLogger(avDC1.class.getName()).log(Level.SEVERE, null, ex);
}
} //end of search-all
}//end of class
这是例外情况:
java.lang.UnsupportedOperationException: Not supported yet.
at DC1.person.<init>(person.java:33)
at DC1.NewClass.<init>(NewClass.java:22)
at DC1.ctrbean.insert(ctrbean.java:76)
DC1.person.java
第 33 行明确抛出一个 UnsupportedOperationException
。也许您或您的同事将其放在那里表明实施尚未完成。否则你应该删除声明
throw new UnsupportedOperationException("Not supported yet");