view_0005fmessage_0002ejsp_jsp.java
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:7k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- import java.sql.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.jsp.*;
- import org.apache.jasper.runtime.*;
- public class view_0005fmessage_0002ejsp_jsp extends HttpJspBase {
- static {
- }
- public view_0005fmessage_0002ejsp_jsp( ) {
- }
- private static boolean _jspx_inited = false;
- public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
- }
- public void _jspService(HttpServletRequest request, HttpServletResponse response)
- throws java.io.IOException, ServletException {
- JspFactory _jspxFactory = null;
- PageContext pageContext = null;
- HttpSession session = null;
- ServletContext application = null;
- ServletConfig config = null;
- JspWriter out = null;
- Object page = this;
- String _value = null;
- try {
- if (_jspx_inited == false) {
- synchronized (this) {
- if (_jspx_inited == false) {
- _jspx_init();
- _jspx_inited = true;
- }
- }
- }
- _jspxFactory = JspFactory.getDefaultFactory();
- response.setContentType("text/html; charset=GBK");
- pageContext = _jspxFactory.getPageContext(this, request, response,
- "", true, 8192, true);
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- // HTML // begin [file="/view_message.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/view_message.jsp";from=(1,31);to=(9,0)]
- out.write("rn<HTML>rn<HEAD>rn<TITLE> show the message in the table </TITLE>rn</HEAD>rn<BODY>rn<p align="center">所有访客留言</p>rn<hr>rn");
- // end
- // begin [file="/view_message.jsp";from=(9,2);to=(35,0)]
- try
- {
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- String url="jdbc:odbc:dsn112";
- Connection con=DriverManager.getConnection(url,"insher","insher");
- Statement stm=con.createStatement();
- ResultSet result=stm.executeQuery("select count(*) from message");
- int message_count=0;
- if(result.next())
- {
- message_count=result.getInt(1);
- result.close();
- }
- if(message_count>0)
- {
- result=stm.executeQuery("select * from message order by time desc");
- while(result.next())
- {
- String title=result.getString("title");
- String name=result.getString("name");
- String mail=result.getString("mail");
- Timestamp time=result.getTimestamp("time");
- Date date_time=new Date(time.getTime());
- Time time_time=new Time(time.getTime());
- String content=result.getString("content");
- // end
- // HTML // begin [file="/view_message.jsp";from=(35,2);to=(38,14)]
- out.write("rn<TABLE width="100%" align="center" border=1 cellspacing="0" cellpadding="0" bordercolordark="#000000" bordercolorlight="#88a6dd">rn<tr><td bgcolor="#88a6dd"><font size=2>主题:</font></td>rn<td colspan=3>");
- // end
- // begin [file="/view_message.jsp";from=(38,17);to=(38,22)]
- out.print(title);
- // end
- // HTML // begin [file="/view_message.jsp";from=(38,24);to=(40,4)]
- out.write("</td></tr>rn<tr><td bgcolor="#88a6dd"><font size=2>留言人:</font></td>rn<td>");
- // end
- // begin [file="/view_message.jsp";from=(40,7);to=(40,11)]
- out.print(name);
- // end
- // HTML // begin [file="/view_message.jsp";from=(40,13);to=(42,0)]
- out.write("</td><td bgcolor="#88a6dd"><font size=2>E-mail:</font></td>rn<td>rn");
- // end
- // begin [file="/view_message.jsp";from=(42,2);to=(44,0)]
- out.println("<a href=mailto:"+mail+">"+mail+"</a>");
- // end
- // HTML // begin [file="/view_message.jsp";from=(44,2);to=(47,0)]
- out.write("rn</td></tr>rn<tr><td bgcolor="#88a6dd"><font size=2>留言时间:</font></td><td colspan=3>rn");
- // end
- // begin [file="/view_message.jsp";from=(47,2);to=(49,0)]
- out.println("<font size=2>"+date_time+" "+time_time+"</font>");
- // end
- // HTML // begin [file="/view_message.jsp";from=(49,2);to=(52,0)]
- out.write("rn</td></tr>rn<tr><td align="center">rn");
- // end
- // begin [file="/view_message.jsp";from=(52,2);to=(54,0)]
- out.println("("+message_count+")");
- // end
- // HTML // begin [file="/view_message.jsp";from=(54,2);to=(56,14)]
- out.write("rn</td>rn<td colspan=3>");
- // end
- // begin [file="/view_message.jsp";from=(56,17);to=(56,24)]
- out.print(content);
- // end
- // HTML // begin [file="/view_message.jsp";from=(56,26);to=(59,0)]
- out.write("rn</td></tr>rn</table>rn");
- // end
- // begin [file="/view_message.jsp";from=(59,2);to=(73,0)]
- out.println("<hr>");
- message_count--;
- }
- result.close();
- con.close();
- }
- else
- {
- out.println("目前还没有任何留言!");
- con.close();
- }
- } catch(Exception e)
- {out.println(e);}
- // end
- // HTML // begin [file="/view_message.jsp";from=(73,2);to=(78,0)]
- out.write("rn<p align="center"><a href="index1.jsp">我要留言</a></p>rn</body>rn</html>rnrn");
- // end
- } catch (Throwable t) {
- if (out != null && out.getBufferSize() != 0)
- out.clearBuffer();
- if (pageContext != null) pageContext.handlePageException(t);
- } finally {
- if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
- }
- }
- }