Olá Pessoal.Estou iniciando a desenvolver uma apliacação web.
Eu criei um projeto no eclipse:("Dynamic Web Project").No projeto só existe a classe Conexao.java que é esta aqui:import java.sql.*;
public class Conexao
{
Connection conexao;
PreparedStatement declaracao;
ResultSet resultado;
public Connection conecta()
{
try
{
try
{
Class.forName("org.postgresql.Driver");
}
catch(Exception e)
{
System.out.println("falha ao carregar o driver de conexao ao banco de dados");
}
conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/bancoteste","postgres","postgres");
}
catch(Exception e)
{
System.out.print("Falha ao carregar a conexão");
}
return conexao;
}
e a página inicial de login que é a index.jsp que tem este conteúdo:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Entrar</title>
</head>
<body>
<%
Conexao con = new Conexao();
%>
</body>
</html>
An error occurred at line: 14 in the jsp file: /index.jsp
Conexao cannot be resolved to a type
11:
12: <%
13:
14: Conexao con = new Conexao();
15:
16:
17: %>