salve a tutti, ho un problema che mi sta dando davv noia; ho una pagina *.jsp che deve richiamare dei metodi di un bean che ho creato il problema è che nn gira ma nn riesco a capire dove sbaglio. vi posto il codice:
codice:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="studente" scope="page" class="project_beans.student_bean"/>
<jsp:setProperty name="studente" property="QueryDBcorsi()"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Scuola</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1>Scuola</h1>
<jsp:getProperty name="studente" property="QueryDBcorsi()"/>
<hr>
</body>
</html>
il bean è il seguente
codice:
package project_beans;
import java.sql.*;
/**
*
* @author theduke
*/
public class student_bean {
private static final String url="*******";
private static final String user ="***";
private static final String pwd = "*****";
private String result;
public student_bean() {
}
public void setQueryDBcorsi() throws SQLException {
result+=("<table border=\"2\" align=\"center\">");
Connection c=DriverManager.getConnection(url, user, pwd);
Statement st=c.createStatement();
ResultSet rs=st.executeQuery("SELECT * FROM CORSI");
while(rs.next()){
result+=(("<tr>"));
result+=("<td>"+rs.getString("ID")+"</td>"+"<td>"+rs.getString("NOME")+"</td>"+"<td>"+rs.getString("DOCENTE")+"</td>"+"<td>" +rs.getString("CREDITI")+"</td>");
result+=("</tr>");
}
result+=("</table>");
rs.close();
st.close();
c.close();
}
public String getQueryDBcorsi(){
return result;
}
}
vi prego aiutatemi...