opa, pessoalll
Seguinte pelos tutorias que vi pela web e meu conehcimento prefio em java consegui fazer uma pagina com o jsp com tudo tomcat postgre e tudo +…
mas estou usando o netbeans ( que adorei trabalhar nele)
não estou conseguindo compilar o codigó, e nao sei pq algume pode me dizer esta ai embaixo
o erro que da eh o seguinte:
Incrementally deploying http://localhost:8084/formularioctc
Completed incremental distribution of http://localhost:8084/formularioctc
Incrementally redeploying http://localhost:8084/formularioctc
FAIL - Application at context path /formularioctc could not be started
FAIL - Application at context path /formularioctc could not be started
C:\Documents and Settings\TI-ctc\formularioctc\nbproject\build-impl.xml:449: Deployment error:
The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 15 seconds)
oq pode ser??
PS: de web sou iniciante…
package AgendaDB;
import java.sql.*;
public class AgendaDB {
private String nome = blank;
private String endereco = blank;
private String cidade = blank;
private String telefone = blank;
private String result_busca = blank;
private String result_inserir = blank;
public static final String BUSCA_INVALIDA = “failure”;
public static final String BUSCA_VALIDA = “success”;
public static final String SUCESSO_INSERCAO = “success”;
public static final String FALHA_INSERCAO = “failure”;
static Connection con = null;
static Statement stm = null;
static ResultSet rs;
static private String blank = “”;
public AgendaDB() {
if (con==null) {
try {
Class.forName(“org.postgresql.Driver”);
con =
DriverManager.getConnection(“jdbc:postgresql://localhost:5432/talita”,“talita”,“tata”);
} catch (SQLException e) {
System.err.println ("Erro: "+e);
con = null;
} catch (ClassNotFoundException e) {
System.out.println(“ClassNotFound…”);
e.printStackTrace();
}
}
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
public String inserir() {
String result_inserir = FALHA_INSERCAO;
try {
stm = con.createStatement();
stm.execute(“INSERT INTO pessoa(nome,endereco,cidade,telefone) VALUES
(’” + nome + “’,’”+
endereco + “’,’” + cidade + “’,’”+ telefone + “’)”);
stm.close();
result_inserir = SUCESSO_INSERCAO;
} catch (SQLException e) {
System.err.println ("Erro: "+e);
result_inserir = FALHA_INSERCAO;
}
return result_inserir;
}
public String buscar() throws SQLException {
String result_busca = BUSCA_INVALIDA;
try {
stm = con.createStatement();
rs = stm.executeQuery(“SELECT * FROM pessoa WHERE nome = '” + nome + “’”);
if (rs.next()) {
nome = rs.getString(1);
endereco = rs.getString(2);
cidade = rs.getString(3);
telefone = rs.getString(4);
result_busca = BUSCA_VALIDA;
}
else
result_busca = BUSCA_INVALIDA;
rs.close();
stm.close();
} catch (SQLException e) {
System.err.println ("Erro: "+e);
}
return result_busca;
}
}
Exemplo JSP
Agenda
Inserir
Buscar
Busca
Digite o nome:
voltar
Inserção
Entre com os dados abaixo
| Nome: | |
| Endereço: | |
| Cidade: | |
| Telefone: |
voltar
não foi encontrado(a)!
voltar
já está cadastrado!Entre com outro nome!
voltar
Resultado da Busca
| Nome: | |
| Endereço: | |
| Cidade: | |
| Telefone: |
voltar
Dados Inseridos com Sucesso!
voltar