📄 box.java
字号:
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class box extends HttpServlet
{
public box()
{
}
public void init(ServletConfig servletconfig)
throws ServletException
{
super.init(servletconfig);
try
{
System.out.println("inside init");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ecare","ecare","ecare");
//Class.forName("oracle.jdbc.driver.OracleDriver");
//con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:project","ecare","ecare");
st=con.createStatement();
System.out.println("statement is created");
}
catch(Exception exception)
{
System.out.println(exception);
}
}
public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
PrintWriter printwriter = httpservletresponse.getWriter();
httpservletresponse.setContentType("text/html");
javax.servlet.http.HttpSession httpsession = httpservletrequest.getSession(true);
try
{
rs = st.executeQuery("select description from hdmessages");
printwriter.println("<html>");
printwriter.println("<head>");
printwriter.println("<style>");
printwriter.println("a{ Text-Decoration:none;}");
printwriter.println("</style>");
printwriter.println("</head>");
printwriter.println("<body>");
printwriter.println("<form > ");
printwriter.println("<P align=center><FONT size=5><STRONG ");
printwriter.println("style='COLOR: forestgreen'><U>EmployeeInfo</U></STRONG></FONT></P>");
printwriter.println("<P align=center> </P>");
printwriter.println("<P align=center>");
printwriter.println("<TABLE border=0 cellPadding=1 cellSpacing=1 style='HEIGHT: 130px; WIDTH: 431px'");
printwriter.println("width=75%>");
printwriter.println("<TR>");
printwriter.println("<TD><strong> LevelName </strong></TD>");
printwriter.println("<TD><strong> UserId </strong></TD>");
printwriter.println("<TD><strong> EmployeeName </strong> </TD>");
printwriter.println("<TD><strong> Website </strong></TD>");
printwriter.println("<TD><strong> Actions </strong></TD></TR>");
for(; rs.next(); printwriter.println("</TR>"))
{
String s = rs.getString("compose1");
System.out.println("desc is" + s);
printwriter.println("<TR>");
printwriter.println("<TD> " + s + " </TD>");
}
printwriter.println("<TR>");
printwriter.println("<TD></TD>");
printwriter.println("<TD></TD>");
printwriter.println("<TD><strong> Click here to </strong> >></TD>");
printwriter.println("<TD> <a href='./superuserview.html'><strong> Go Back </strong></a></TD></TR>");
printwriter.println("<TR>");
printwriter.println("<TD></TD>");
printwriter.println("<TD></TD>");
printwriter.println("<TD></TD>");
printwriter.println("<TD></TD></TR></TABLE></P>");
printwriter.println("<P align=center> </P>");
printwriter.println("</form>");
printwriter.println("</body>");
printwriter.println("</html>");
}
catch(Exception exception)
{
System.out.println(exception);
}
}
Connection con;
Statement st;
ResultSet rs;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -