📄 index_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList(1);
_jspx_dependants.add("/conn.jsp");
}
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
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 {
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('\r');
out.write('\n');
java.sql.Connection conn;
java.sql.Statement stmt;
java.sql.ResultSet rs;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=modules";
String user="sa";
String password="123";
conn=DriverManager.getConnection(url,user,password);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
out.write('\r');
out.write('\n');
out.write('\r');
out.write('\n');
/*
留言管理模块
*/
String condition="select * from system";
rs=stmt.executeQuery(condition);
rs.next();
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>");
out.print(rs.getString("title"));
out.write("</title>\r\n");
out.write("<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write("<!--\r\n");
out.write(".style1 {font-family: \"宋体\"}\r\n");
out.write(".style2 {font-size: 9px}\r\n");
out.write(".style3 {color: #9999CC; text-decoration: none; font-family: \"宋体\";}\r\n");
out.write(".style4 {font-size: 9pt}\r\n");
out.write(".style5 {color: #999999}\r\n");
out.write(".style6 {font-family: \"宋体\"; color: #999999; }\r\n");
out.write(".style7 {color: #FF0000}\r\n");
out.write(".style8 {font-family: Tahoma}\r\n");
out.write("a.rights:link {\r\n");
out.write("\tCOLOR: #000000;\r\n");
out.write("\tTEXT-DECORATION: none;\r\n");
out.write("\t\r\n");
out.write("}\r\n");
out.write("a.rights:visited {\r\n");
out.write("\tCOLOR: #000000;\r\n");
out.write("\tTEXT-DECORATION: none;\r\n");
out.write("\t\r\n");
out.write("}\r\n");
out.write("a.rights:hover {\r\n");
out.write("\tCOLOR: #FF0000; \r\n");
out.write("\tTEXT-DECORATION: none;\r\n");
out.write("\t\r\n");
out.write("}\r\n");
out.write(".style9 {\r\n");
out.write("\tfont-size: 9pt;\r\n");
out.write("\tcolor: #FF0000;\r\n");
out.write("\tfont-weight: bold;\r\n");
out.write("}\r\n");
out.write("-->\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<body background=\"img/beijing.gif\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n");
out.write("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tittle1\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"26\" background=\"img/bg.gif\"><table width=\"100%\" height=\"15\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
out.write(" <tr align=\"center\">\r\n");
out.write(" <td width=\"41%\" class=\"font0\"><span class=\"font0\">版主:</span><font color=\"#006699\">");
out.print(rs.getString("adminname"));
out.write("</font></td>\r\n");
out.write(" <td width=\"59%\">");
if (null != session.getAttribute("userid")){
out.write("<a href=\"my_index.jsp\" class=\"font0\">我的留言</a> <span class=\"font0\">│</span> ");
}
out.write("<a href=\"reg.jsp\" class=\"font0\">注册用户</a> <span class=\"font0\">│</span> <a href=\"add.jsp\" class=\"font0\">给我留言</a> <span class=\"font0\">│</span> <a href=\"login.jsp\" class=\"font0\">管理登录</a><font color=\"#000099\"> </font><span class=\"font0\">│</span> <span><a href=\"system.jsp\" class=\"font0\">系统设定</a></span><font color=\"#000099\"> </font></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("<table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"40\" align=\"center\" valign=\"middle\"><table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td width=\"25\" align=\"right\"><img src=\"img/fav_add.gif\" width=\"25\" height=\"25\"></td>\r\n");
out.write(" <td valign=\"bottom\"> <p> \r\n");
out.write(" <marquee height=20 hspace=5 loop=100 scrollamount=2\r\n");
out.write(" scrolldelay=10 width=100% on=\"left\" DIRECTI \r\n");
out.write(" align=\"center\">\r\n");
out.write(" <span class=\"style9\">");
out.print(rs.getString("news"));
out.write(" </span> \r\n");
out.write(" </marquee>\r\n");
out.write(" </p></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"right\"> </td>\r\n");
out.write(" <td align=\"center\"> \r\n");
out.write(" <form name=\"form1\" method=\"post\" action=\"\">\r\n");
out.write(" <input name=\"key\" type=\"text\" id=\"key\"> \r\n");
out.write(" <input type=\"submit\" name=\"Submit\" value=\"留言搜索\">\r\n");
out.write(" </form></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
String key=request.getParameter("key");
String condition2="select * from message";
if(null!=key && key.length()>0)
condition2=condition2+" where [name] like '%"+key+"%' or content like '%"+key+"%' or recontent like '%"+key+"%'";
condition2=condition2+" order by id DESC";
rs=stmt.executeQuery(condition2);
int intPageSize= 8,intRowCount,intPageCount,intPage,i;
String strPage = request.getParameter("page");
if(strPage==null)
intPage = 1;
else{
intPage = Integer.parseInt(strPage);
if(intPage<1){ intPage = 1;}
}
rs.last();
intRowCount = rs.getRow();
intPageCount =(intRowCount+intPageSize-1) / intPageSize;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -