?? viewnewsdetail.jsp
字號:
<%@page contentType="text/html; charset=gb2312" errorPage=""%>
<%@page import="java.sql.*,sms.db.*,sms.bean.*,java.util.*"%>
<%
//------------------------取得新聞詳細內容-------------------------------
String newsId = request.getParameter("id"); //取得新聞編號
NewsBean newsBean = new NewsBean();
NewsBean newsBean2 = newsBean.queryDetail(newsId);
//------------------------如果新聞為空,將請求轉發到新聞標題分類瀏覽頁面-----
if (newsBean2 == null || newsBean2.getId() == null) {
RequestDispatcher dispatcher = null;
dispatcher = request.getRequestDispatcher("/viewNewsTitle.jsp");
dispatcher.forward(request, response);
}
//------------------------取得相關新聞標題--------------------------------
ArrayList aList = null;
if (newsBean2 != null && newsBean2.getTypeId() != null) {
aList = newsBean.queryTitle(newsBean2.getTypeId(), 8);
}
String temp = "";
if (newsBean2.getContent() != null && newsBean2.getContent().length() > 30) {
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新聞詳細內容</title>
<style type="text/css">
<!--
.style1 {
font-family: "華文中宋";
font-size: 5mm;
.12v {
FONT-SIZE: 12px;
LINE-HEIGHT: 170%;
text-transform: capitalize;
}
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
margin-top: 0px;
margin-bottom: 0px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style></head>
<body>
<table width="850" align="center" border="0">
<tr>
<td height="31" bgcolor="#6666CC">
<a href="newsHome.jsp">新聞動態</a>
>>
<a href="viewNewsTitle.jsp?type=1">新聞分類瀏覽</a>
>>
新聞詳細信息
</td>
</tr>
<tr>
<td height="252" align="center" valign="middle">
<table width="100%" border="1" bordercolorlight=#C1A4F4 borderColorDark=#ffffff cellPadding=0 cellSpacing=0 bgcolor="#FFFFCC" >
<tr align="center" valign="middle" bgcolor="#CCCCFF">
<td height="30" colspan="4" nowrap>
<span class="style1"><%=newsBean2.getTitle()%></span>
</td>
</tr>
<tr bgcolor="#9999CC">
<td width="23%" height="24" align="right"> </td>
<td width="18%">來源:<%=newsBean2.getQuarry()%></td>
<td width="20%">時間:<%=newsBean2.getAddTime()%></td>
<td width="39%">作者:<%=newsBean2.getAuthor()%></td>
</tr>
<tr bgcolor="#CCCCCC">
<td height="223" colspan="4" style="word-break:break-all"><blockquote>
<br>
<br> <%=newsBean2.getContent()%>
</blockquote>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="1" bordercolorlight=#C1A4F4 borderColorDark=#ffffff cellPadding=0 cellSpacing=0>
<tr bgcolor="#999999">
<th width="70%" height="25" align="left" scope="col">相關新聞</th>
<th width="12%" scope="col">時間</th>
<th width="9%" scope="col">來源</th>
<th width="9%" scope="col">作者</th>
</tr>
<%
//-------------------以下用于顯示相關新聞標題列表-----------------------
if (aList != null && aList.size() > 0) {
NewsBean newsBean3 = null;
for (int i = 0; i < aList.size(); i++) {
newsBean3 = (NewsBean) aList.get(i);
if (newsBean3.getId() != null && !newsBean3.getId().equals(newsId)) {
%>
<tr>
<td height="25">
<a href="viewNewsDetail.jsp?id=<%=newsBean3.getId()%>"><%=newsBean3.getTitle()%> </a>
</td>
<td align="center"><%=newsBean3.getAddTime()%></td>
<td align="center"><%=newsBean3.getQuarry()%></td>
<td align="center"><%=newsBean3.getAuthor()%></td>
</tr>
<%
}
}
} else {
%>
<tr>
<td height="25" colspan="4"> </td>
</tr>
<%} %>
</table>
</td>
</tr>
<tr>
<td height="23" bgcolor="#6666CC"> </td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -