0

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();}

}
}
  • 1
    Try with `#{insertUsuarios.addUsuarios}` on button code, or use `@ManagedBean(name = "iu")` on your bean. Unrelated to this, your query is missing some spaces between it's parts. – Predrag Maric May 08 '15 at 13:59
  • 1
    What is `iu` in this EL `action="#{iu.addUsuarios}"`? The managed bean name is `insertUsuarios` and it is request scoped by default. – Tiny May 08 '15 at 14:45
  • iu is a managedbean which it does calls to the InsertaUsuarios class – Michael Perez May 09 '15 at 04:19

0 Answers0