Well, hi comunity, i'm a newbie here (also programming hehe) well i started a little jsf proyect which i was trying to make an insert operation into the database, im working with eclipse Java EE version and using Toad as Db manager, so, as well, you can see my code below; There is the error which Eclipse puts on the browser
Estado HTTP 500 - javax.el.PropertyNotFoundException: /insertaUsuario.xhtml @50,57 action="#{iu.addUsuarios}": Objetivo inalcanzable, identificador 'iu' resuelto a nulo... (Objective unreachable, identifier 'iu' resolved to null)
And here is the Java/side code,i'll be glad of your help and if you advise me of something.
package com.MainApp.bean;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class InsertUsuarios {
public void addUsuarios() {
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
final String DBURL = "jdbc:oracle:thin:@localhost:1521:XE";
final String DBUSER = "SYSTEM";
final String DBPASS = "SYSTEM";
Connection con;
con = DriverManager.getConnection(DBURL, DBUSER, DBPASS);
Usuarios Usuario;
Usuario = new Usuarios();
String name = Usuario.getNombre();
String lname = Usuario.getApellido();
String idc = Usuario.getCedula();
String salary = Usuario.getSueldo();
Statement statement = con.createStatement();
statement.executeQuery("INSERT INTO SYSTEM.USUARIOS"+"NOMBRE,CEDULA,APELLIDO,SUELDO"+
"VALUES('"+name+"','"+lname+"',"+idc+","+salary+")");
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();}
}
}