⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pic_005fdetail_jsp.java

📁 JSP版的在线相册系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

public final class pic_005fdetail_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  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;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\n");
      out.write("<title>对图片发表评论</title>\n");
      out.write("<style type=\"text/css\">\n");
      out.write("<!--\n");
      out.write(".style1{font-size: 12px}\n");
      out.write("-->\n");
      out.write("</style>\n");
      out.write("\n");
      out.write("</head>\n");
      out.write("<body>\n");
      photo.StrFormat format = null;
      synchronized (_jspx_page_context) {
        format = (photo.StrFormat) _jspx_page_context.getAttribute("format", PageContext.PAGE_SCOPE);
        if (format == null){
          format = new photo.StrFormat();
          _jspx_page_context.setAttribute("format", format, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');
      photo.DBConnection dbconn = null;
      synchronized (_jspx_page_context) {
        dbconn = (photo.DBConnection) _jspx_page_context.getAttribute("dbconn", PageContext.PAGE_SCOPE);
        if (dbconn == null){
          dbconn = new photo.DBConnection();
          _jspx_page_context.setAttribute("dbconn", dbconn, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\n");
      out.write("<p>\n");
      out.write("  ");
try{int i=Integer.parseInt(request.getParameter("picture_id"));//request.setCharacterEncoding("GBK");//String picture_title=format.StrFormat(request.getParameter("picture_title"));Connection conn=dbconn.getConnection();String sql1="select * from pictures where picture_id="+i;Statement stmt1 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);ResultSet rs1=stmt1.executeQuery(sql1);if(rs1.next())
      out.write("\n");
      out.write("</p>\n");
      out.write("<table width=\"100%\" border=\"1\">\n");
      out.write("  <tr>\n");
      out.write("    <td height=\"30\">标题:");
      out.print(rs1.getString("picture_title"));
      out.write("</td>\n");
      out.write("  </tr>\n");
      out.write("  <tr>\n");
      out.write("    <td><img alt=\"\" src=\"pic_show.jsp?picture_id=");
      out.print(i);
      out.write("\"></td>\n");
      out.write("  </tr>\n");
      out.write("</table>\n");
      out.write("<p>\n");
      out.write(" ");
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); String sql="select * from comments where picture_id="+i;ResultSet rs=stmt.executeQuery(sql); while(rs.next()){ 
      out.write("\n");
      out.write("</p>\n");
      out.write("\n");
      out.write("<p><span class=\"style1\">评论内容:</span></p>\n");
      out.write("<p>");
      out.print(rs.getString("content"));
      out.write("</p>\n");
      out.write("<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span class=\"style1\">发表人:</span>");
      out.print(rs.getString("user_name"));
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"style1\">&nbsp;发表时间</span>:");
      out.print(rs.getString("comment_time"));
      out.write("</p>\n");
      out.write("<hr>\n");
      out.write("\n");
}
      out.write("\n");
      out.write("<form name=\"form1\" method=\"post\" action=\"add_comments.jsp\">\n");
      out.write("  <p>发表评论:\n");
      out.write("  </p>\n");
      out.write("  <p>\n");
      out.write("    <textarea name=\"content\" rows=\"10\" cols=\"90\"></textarea>\n");
      out.write("  </p>\n");
      out.write("  <p>\n");
      out.write("    <input type=\"hidden\" name=\"picture_id\" value=\"");
      out.print(i);
      out.write("\">\n");
      out.write("</p>\n");
      out.write("  <p>\n");
      out.write("    <input type=\"submit\" name=\"Submit\" value=\"发表\">\n");
      out.write("    <input type=\"reset\" name=\"Submit2\" value=\"重写\">\n");
      out.write("</p>\n");
      out.write("</form>\n");
      out.write("<p align=\"center\" class=\"style411\"><a href=\"browse.jsp\">返回</a></p>\n");
      out.write("</body>\n");
rs1.close();stmt1.close();rs.close();stmt.close();conn.close();}catch(Exception e){e.printStackTrace();}
      out.write("\n");
      out.write("</html>\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -