Alıntı:
GVertigang Nickli Üyeden Alıntı
Kodlar normal gibi geldi. LongServlet'in tanınmasında bir sıkıntı olabilir. Yine de kodları aşağıda attığım gibi revize edip deneyin isterseniz.
JSP: Kod: <body>
<div class="login-box">
<h2>Giriş</h2>
<form action="LoginServlet" method="post">
<input type="email" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Şifre" required>
<button type="submit">Giriş</button>
<div class="register-link">
<p>Hesabınız yok mu? <a href="kayit.jsp">Kayıt olun</a></p>
</div>
</form>
</div>
</body>
</html> LoginServlet:
Veritabanı bağlantısı: Kod: import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnect {
static String url = "jdbc:postgresql://localhost:5432/Mulakat";
public static Connection baglanti = null;
public static void connect() throws SQLException {
try {
// JDBC sürücüsünü yükleme (eğer gerekliyse)
// Class.forName("org.postgresql.Driver");
baglanti = DriverManager.getConnection(url, "postgres", "jacobo93");
if(baglanti != null) {
System.out.println("Veritabanı bağlantısı tamamlandı");
} else {
System.out.println("Veritabanı bağlantısı başarısız.");
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
} |
maalesef olmadı hocam. aynen alıp yapıştırdım şu sayfa çıktı. bomboş beyaz sayfa ;
sonra try catch'e hata metni ekledim bakalım veritabanında mı sorun var diye. evet ;