基于用户的新闻系统!之十三
新闻显示文件,即主页面。
文件名:show.jsp

<%@page contentType="text/html;charset=GB2312"%>
<%@include file=
"inc.jsp"%>
<link rel=stylesheet href=
"images/grass.css" type="text/css"]
<Script language=
"JavaScript"]
//打开新窗口函数NewsWindow
function NewsWindow(id)
{
window.open('newswind.jsp?id='+id,'infoWin', 'height=400,width=600,scrollbars=yes,resizable=yes');
}
</Script>
<body >
[div id=container><!-- ============================================================ --><!-- Begin topBanner -->
[div id=logo><IMG height=60 src=
"images/showimage.jpg" width=780>[/div]<!-- End topBanner --><!-- ============================================================ -->
[div id=center>
[div class=content><!-- ============================================================ --><!-- Begin panel3 Body -->
[div class=postTitle>
<form name=
"form" method="post" action="login.jsp"]
<%
String uID2=(String)session.getAttribute(
"uID1");

if(uID2==null){
%><font color=#ffffff>
用户名:
<input name=
"UID" class="td" size="15">
密码:
<input type=
"password" name="password" class="td" size="15"]
<input type='image' name='submit2' src='images\go.gif' align=absmiddle border=0 width=
"22" height="16"]
&nbsp;&nbsp;
<%
}
else {
out.println(
" <MARQUEE behavior=alternate scrollAmount=3 width='100%'><font color=red size=3>欢迎你!"+uID2+"</font>");
out.println(
"</font></MARQUEE>");
}
%> [/div>
[div class=postText>
<%
int i;
int ipage=10;
//分页单位
int allpage;
//总页数
int pages;
//接受的页码变量
int cpage=1;
//当前页
int spage;
//开始页
int intRowCount;
//总记录数
sql=
"select * from new_sz " ;
rs = apple.select(sql);
rs.last();
intRowCount=rs.getRow();
allpage=(intRowCount+ipage-1) / ipage;
if (request.getParameter(
"pages")==null) {
pages=1;
} else {
pages = new Integer(request.getParameter(
"pages")).intValue();
}
if(pages > allpage ){
// pages == 0){
cpage = 1;
} else {
cpage = pages;
}
spage=(cpage-1)*ipage;
apple. closeConn();

sql=
"select * from new_sz order by id desc limit "+ spage +","+ ipage ;
rs = apple.select(sql);

%>
<table border=
"0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="64%"]
<tr>
<td width=
"33%" align="center"]主题</td>
<td width=
"33%" align="center"]作者</td>
<td width=
"34%" align="center"]
<p align=
"center">时间</td>
</tr>
<tr>
<% while (rs.next()) { %>
<td width=
"33%"]<a href="javascript:NewsWindow(<%=rs.getInt("ID")%>)"]<u>
<%String title=rs.getString(
"title");
title=new String(title.getBytes(
"ISO-8859-1"),"GB2312" );
%>
<%=title%></u>[/url] </td>
<td width=
"33%"] <%String author=rs.getString("author");
author=new String(author.getBytes(
"ISO-8859-1"),"GB2312" );
%>
<%=author%>

[div align=
"center"][/div] </td>
<td width=
"34%"]<%=rs.getString("Date")%> </td>
</tr>
<%}%>
<tr>
<td width=
"33%"] </td>
<td width=
"33%"]所有页数:
<%out.println(allpage);%>&nbsp;&nbsp;
</td>
<td width=
"34%"]pages:<%for(int j=1;j<=allpage;j++)
{
out.println(
"<a href=show.jsp?pages=" + j + "]" + j + "[/url]&nbsp;&nbsp;");
}
%> </td>
</tr>
</table>
<%

apple. closeConn();
%>
[/div]
[div class=postTitle>
<%
if(uID2!=null)
{
if (uID2.equals(
"mimi"))
{out.print(
"<a href =newsedit.jsp><font color='#FFFFFF'>新闻管理</font>[/url> <a href=admuser.jsp><font color='#FFFFFF'>用户管理</font>[/url>");}
else {
out.print(
"<font color='#FFFFFF'>新闻管理</font>");
}
}
%> [/div>
<!-- End panel3
-->[/div][/div]<!-- ============================================================ -->
[div id=right>
[div class=sidebar>
<!-- GuestBook -->
<H2>留言 </H2>
<UL>
<LI>
<A href=
"newsadd.jsp"]新闻发布&nbsp;&nbsp;[/url]
<A href=
"regname.jsp"]注 &nbsp;&nbsp; 册[/url] <br>
<A href=
" login.jsp"]登 &nbsp;&nbsp;陆[/url]
<A href=
"logout.jsp"]注 &nbsp;&nbsp; 销[/url]
<A href=
"newsedit.jsp"]新闻修改&nbsp;&nbsp;[/url]

</LI>
</UL>
<!-- ============================================================ --><!-- Begin panel2 -->
<!-- End panel2 --><!-- ============================================================ --></LI>[/div][/div]<!-- ============================================================ --><!-- Begin footer -->
[div id=powered>
<BR>卓达经济管理学院 [/div]<!-- End footer --><!-- ============================================================ -->[/div]</BODY></HTML>
lunzi   2004-12-05 18:25:39 评论:0   阅读:1279   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog