In Below code JDBC connection is done in JSP file itself. What the harm in that. I am new to this and finding in most of the sites its asked to use JSTL for SQL data, what is the difference between JSTL and JSP then and which one is better?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Home Page</title>
</head>
<body>
<%@include file="DBDetails.jsp"%>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, username, password);
statement = connection.createStatement();
Code TO get Table Values Et
%>
<%User user = (User) session.getAttribute("User"); %>
<h3>Hi <%=user.getName() %></h3>
<strong>Your Email</strong>: <%=user.getEmail() %><br>
<strong>Your Country</strong>: <%=user.getCountry() %><br>
<br>
<form action="Logout" method="post">
<input type="submit" value="Logout" >
</form>
</body>
</html>