package cwp; import java.io.IOException; import javax.servlet.*; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.TagSupport;// tells the system what to do when it sees the tag. import java.sql.*; public class DataBase extends TagSupport { String getMonth=new String(); public int doStartTag() throws JspException { Connection con=null; Statement stmt=null; ResultSet rs=null; try { pageContext.getOut().print("Data Base Connection for the month "+ getMonth); pageContext.getOut().print("

"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:ayedduladb",null,null); stmt=con.createStatement(); rs=stmt.executeQuery("select date,text from " +getMonth ); pageContext.getOut().println(""); pageContext.getOut().println("" ); while(rs.next()) { pageContext.getOut().println("" ); } pageContext.getOut().println("
Day Calendar
" + rs.getString(1) + "" + rs.getString(2) +"
"); } catch(Exception e) { }finally { } return SKIP_BODY; } public void setMonth(String strMonth) { getMonth=strMonth; System.out.println(strMonth); } }