<h3><m:student_skip>Joe Jones</m:student_skip></h3>  <hr />

(SKIP_BODY) - The Students information is


package mytags;  
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.*;
import java.sql.*;  

public class GetStudentskip extends BodyTagSupport {
    private String name;
    private JspWriter out;
    static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";  
    static final String DB_URL = "jdbc:mysql://localhost/cs4010";
    static final String USER = "cs4010";
    static final String PASS = "cs4010";

    public int doStartTag() throws JspException {  
        out=pageContext.getOut();  
        try {
            out.print("(<font color='BLUE'>SKIP_BODY</font>) - The Students information is ");  
        } catch (Exception e) {
            e.printStackTrace();
        }


        return SKIP_BODY;
        }

// TheStudent() is not called.    
    public String TheStudent(String who){
        Connection conn = null;
        Statement stmt = null;
        String theReturn="";
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(DB_URL,USER,PASS);
            stmt = conn.createStatement();
            String this_query="SELECT name, year, test FROM student where name=\"";
            this_query=this_query+who+"\";";
            ResultSet rs = stmt.executeQuery(this_query);
            while (rs.next()) {
                String the_name  = rs.getString("name");               
                String the_year = rs.getString("year");
                int the_grade = rs.getInt("test");
                theReturn="Name: " + the_name + " Year: "+the_year+" Grade: "+the_grade;
            }
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return theReturn;
    }
}