📄 post_0002ejsp_jsp.java
字号:
import java.sql.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class post_0002ejsp_jsp extends HttpJspBase {
static {
}
public post_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="/post.jsp";from=(0,48);to=(1,0)]
out.write("\r\n");
// end
// HTML // begin [file="/post.jsp";from=(1,31);to=(2,0)]
out.write("\r\n");
// end
// HTML // begin [file="/post.jsp";from=(2,31);to=(3,0)]
out.write("\r\n");
// end
// HTML // begin [file="/post.jsp";from=(3,31);to=(15,0)]
out.write("\r\n\r\n<html>\r\n<head>\r\n<title>回贴显示效果</title>\r\n<style type=\"text/css\">\r\n<!--\r\n.style1 {font-size: 36px}\r\n-->\r\n</style>\r\n</head>\r\n<body bgcolor=\"#ffffff\">\r\n");
// end
// begin [file="/post.jsp";from=(15,0);to=(15,30)]
{
String _jspx_qStr = "";
JspRuntimeLibrary.include(request, response, "logo.jsp" + _jspx_qStr, out, false);
if ("true".equals(request.getAttribute("javax.servlet.forward.seen")))
return;
}
// end
// HTML // begin [file="/post.jsp";from=(15,30);to=(18,0)]
out.write("\r\n\r\n<table width='90%' border=1 align=\"center\">\r\n");
// end
// begin [file="/post.jsp";from=(18,2);to=(55,0)]
String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
Connection conn;
PreparedStatement ps;
ResultSet rs;
int postid=0,forcumid=0;//
Object username=session.getAttribute("username");
if(username!=null){
// ------
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bbs","","");
postid=Integer.parseInt(request.getParameter("postid"));
forcumid=Integer.parseInt(request.getParameter("forcumid"));//
String s="select * from post where postid=? or parentid=?";
ps=conn.prepareStatement(s);
ps.setInt(1,postid);
ps.setInt(2,postid);
rs=ps.executeQuery();
int count=1;
while(rs.next()){
String head=rs.getString(2);
String content=rs.getString(3);
int userid=rs.getInt("userid");
String sql="select * from user where userid="+userid;
Statement sm2=conn.createStatement();
ResultSet rs2=sm2.executeQuery(sql);
String userName="",userSex="",usernickname="",
userIMAGE="images/2.gif";
if(rs2.next()){
userName=rs2.getString(2);
userSex=rs2.getString(5);
if(userSex.equals("女"))
userIMAGE="images/1.gif";
usernickname=rs2.getString(4);
}
// end
// HTML // begin [file="/post.jsp";from=(55,2);to=(57,27)]
out.write("\r\n<tr >\r\n<td width=20% rowspan=\"2\" >");
// end
// begin [file="/post.jsp";from=(57,30);to=(57,38)]
out.print(userName);
// end
// HTML // begin [file="/post.jsp";from=(57,40);to=(57,46)]
out.write(" <br> ");
// end
// begin [file="/post.jsp";from=(57,49);to=(57,61)]
out.print(usernickname);
// end
// HTML // begin [file="/post.jsp";from=(57,63);to=(57,77)]
out.write("<br><img src=\"");
// end
// begin [file="/post.jsp";from=(57,80);to=(57,89)]
out.print(userIMAGE);
// end
// HTML // begin [file="/post.jsp";from=(57,91);to=(58,4)]
out.write("\"/><br>\r\n注册时间");
// end
// begin [file="/post.jsp";from=(58,6);to=(58,24)]
out.println(date);
// end
// HTML // begin [file="/post.jsp";from=(58,26);to=(59,4)]
out.write("<br>\r\n最后登录");
// end
// begin [file="/post.jsp";from=(59,7);to=(59,30)]
out.print(request.getRemoteAddr());
// end
// HTML // begin [file="/post.jsp";from=(59,32);to=(61,31)]
out.write("<br>\r\n</td>\r\n<td width=60% valign=top><b>标题:");
// end
// begin [file="/post.jsp";from=(61,34);to=(61,38)]
out.print(head);
// end
// HTML // begin [file="/post.jsp";from=(61,40);to=(64,33)]
out.write("</b></td>\r\n</tr>\r\n<tr>\r\n <td valign=top><br> ");
// end
// begin [file="/post.jsp";from=(64,36);to=(64,43)]
out.print(content);
// end
// HTML // begin [file="/post.jsp";from=(64,45);to=(67,6)]
out.write("</td>\r\n</tr>\r\n<tr>\r\n <td>第");
// end
// begin [file="/post.jsp";from=(67,9);to=(67,14)]
out.print(count);
// end
// HTML // begin [file="/post.jsp";from=(67,16);to=(70,0)]
out.write("楼</td>\r\n</tr>\r\n\r\n");
// end
// begin [file="/post.jsp";from=(70,2);to=(76,0)]
count++;
}
}catch(Exception e){
System.out.println(e);
}
// end
// HTML // begin [file="/post.jsp";from=(76,2);to=(85,51)]
out.write("\r\n</table>\r\n\r\n<table width='90%' border=1 align=\"center\">\r\n<form action=\"reply.jsp\" method=\"post\">\r\n<tr><td>标题:</td>\r\n<td><input type=\"text\" name=\"head\" size=\"50\"/></td>\r\n<tr><td>内容:</td>\r\n<td><textarea rows=\"10\" name=\"content\" cols=\"100\"></textarea></td>\r\n<tr><td><input type=\"hidden\" name=\"forcumid\" value=");
// end
// begin [file="/post.jsp";from=(85,54);to=(85,62)]
out.print(forcumid);
// end
// HTML // begin [file="/post.jsp";from=(85,64);to=(86,47)]
out.write("></td>\r\n<td><input type=\"hidden\" name=\"parentid\" value=");
// end
// begin [file="/post.jsp";from=(86,50);to=(86,56)]
out.print(postid);
// end
// HTML // begin [file="/post.jsp";from=(86,58);to=(90,0)]
out.write("></td></tr>\r\n<tr><td colspan=\"2\"> <input type=\"submit\" value=\"回复\"/></td></tr>\r\n</form>\r\n</table>\r\n");
// end
// begin [file="/post.jsp";from=(90,2);to=(94,0)]
}else{
out.println("<script>alert('请先登录!');this.location.href='login.jsp';</script>");
}
// end
// HTML // begin [file="/post.jsp";from=(94,2);to=(97,0)]
out.write("\r\n</body>\r\n</html>\r\n");
// 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);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -