📄 showmessage.jsp
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="shop.logBean"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>Shop</title>
</head>
<body bgcolor=#C0C0C0>
<center>
<%
String title="";
String time="";
String message="";
String fromid="";
if(session.isNew()){
%>
<jsp:forward page="index.jsp"/>
<%
}
else {
%>
<jsp:useBean id="log" class="shop.logBean" scope="session"/>
<%
String islog=log.getIslog();
if(!islog.equals("true")){
%>
<jsp:forward page="index.jsp"/>
<%
}
else{
%>
<center>
<jsp:getProperty name="log" property="id"/>
,私人留言
<%
if(log.getId().equals("admini")){
%>
<jsp:include page="adminihead.txt"/>
<%
}
else{
%>
<jsp:include page="head.txt"/>
<%
}
%>
</center>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
Statement sql;
ResultSet rs;
con=DriverManager.getConnection("jdbc:odbc:myshop","","");
sql=con.createStatement();
String condition="SELECT * FROM message where userid="+"'"+log.getId()+"'";
rs=sql.executeQuery(condition);
int rowcount=0;
String temp=request.getParameter("rowcount");
int rc=(Integer.valueOf(temp)).intValue();
while(rs.next()){
rowcount++;
if(rowcount==rc){
title=rs.getString("title");
time=rs.getString("time");
message=rs.getString("message");
fromid=rs.getString("fromid");
%>
<center>
<br>
<br>
<table width="500" border="1">
<tr>
<td width="100">标题</td>
<td width="400"><%=title%></td>
</tr>
<tr>
<td width="100">时间</td>
<td width="400"><%=time%></td>
</tr>
<tr>
<td width="100">作者</td>
<td width="400"><%=fromid%></td>
</tr>
<tr>
<td width="100">内容</td>
<td width="400"><%=message%></td>
</tr>
</table>
</center>
<%
}
}
%>
<%
con.close();
}catch(SQLException e){
%>
<jsp:forward page="index.jsp"/>
<%
}catch(ClassNotFoundException e){
%>
<jsp:forward page="index.jsp"/>
<%
}
}
}
%>
<a href="addmessage.jsp?title=Re:<%=title%>&toid=<%=fromid%>">回复</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -