'How JSP get Data from SQL server using Tag

I am trying to get the resultList to my jsp using tag.

public class DBUtil {
    
    public String getData()throws SQLException, ClassNotFoundException{
        String resultList = "";
        try {

            Connection connection = DriverManager.getConnection("jdbc:sqlserver://s1234567.onlinehome-server.com;database=DB;integratedSecurity=false","user","password");
            Statement statement = connection.createStatement();
            ResultSet resultSet = statement.executeQuery("SELECT Students.firstName,Students.mi, Students.lastName, Students.phone FROM Students WHERE Students.ssn ='' +ssn+");
            while (resultSet.next()){
                resultList = resultList + "<li>"+resultSet.getString(1)+"\t" + resultSet.getString(2) + "\t" + resultSet.getString(3)+ "\t"+ resultSet.getString(4)+ "\t"+ "</li>\n";
            }
        }catch (SQLException ex){
            ex.getMessage();
            ex.printStackTrace();
        }return resultList;
    }
}

For my jsp file, after I import the DButil.java, I am not really sure how to get the resultList in the tag

<%DButil.class.getClasses()%> // ???


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source