📄 my_newslist.jsp
字号:
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*"%>
<% String uid = (String)session.getAttribute("zgbh");
if(uid==null){
response.sendRedirect("oa/session_oa.htm");
return;
}
oa.bean.PersonBean myBean = null;
oa.bean.MynewsBean newsBean = null;
oa.bean.OrgMenuBean orgmenuBean = null;
oa.bean.ArticleBean articleBean = null;
try{
oa.main.DealString ds = new oa.main.DealString();
myBean = new oa.bean.PersonBean();
newsBean = new oa.bean.MynewsBean();
orgmenuBean = new oa.bean.OrgMenuBean();
articleBean = new oa.bean.ArticleBean();
if ( myBean.getConn() == null
|| newsBean.getConn() == null
|| orgmenuBean.getConn() == null
|| articleBean.getConn() == null )
{
%>
数据库无法响应,请<a href="javascript:window.history.back(-1);">返回</a>重试
<%out.close();
}
myBean.setPersonNO(uid.trim());
// String name = myBean.getPsBmName();
String bmbh = myBean.getBMBH();
String name = myBean.getFatherName(bmbh);//strOrgNO
String strOrgNO = myBean.getOrgNO();
if(name.equals(""))
name = myBean.getPsBmName();
else
name = name.substring(0,name.length()-1);
// name = bmMC + name;
String lx = ds.toGBK(ds.toString(request.getParameter("lx")));
String strlx = lx;
String only = ds.toString(request.getParameter("only"));
String stronly = only;
newsBean.setUID(uid);
String bm = (String)request.getParameter("bm");
if(bm==null) bm = "1";
if(bm.equals(""))bm = "1";
int cur = Integer.parseInt(bm);
int sum = 1;
// Vector v = newsBean.getLastNews(lx,cur);
// int sum = Integer.parseInt((String)v.get(0));
//分辨率
String w = ds.toString((String)session.getAttribute("SCREEN"));
int rows = 800;
if(!w.equals(""))rows = Integer.parseInt(w);
int wlen=(rows-200)/16-3;
rows = rows - 600;
rows = rows/40;
Vector v111 = orgmenuBean.getOnePage("select bh from orgmenu where mc='"+lx+"' and bmbh='"+strOrgNO+"'",1,1);
String strID1 = (String)((Hashtable)v111.get(1)).get("BH");
orgmenuBean.setID(Integer.parseInt(strID1));
String flx = orgmenuBean.getID1();//取得一级类别名称
Vector vetmenu2 = new Vector();
Hashtable hash1 = new Hashtable();
if(!only.equals("1")){
vetmenu2 = (Vector)orgmenuBean.getDownCs(strID1); //取得下一级类信息
}
hash1.put("BH",strID1);
if(vetmenu2.size()==0){
hash1.put("MC",lx);
wlen = wlen * 2;
}
else
hash1.put("MC","其他");
vetmenu2.add(hash1);
int jmenu2=vetmenu2.size();
int jnum=(jmenu2+1)/2; //新闻显示行数
int intnumconf = 10;
%>
<html>
<head>
<title>个人主页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/my_new.css" type="text/css">
</head>
<body class="bgl" bgcolor="#F7F7F7">
<table width="100%" border="0" cellspacing="0" cellpadding="0" valign=top>
<tr width="100%">
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="2969B5">
<td width="12" height="22"><img src="image/index/connerx1.gif" width="12" height="22"></td>
<td height="22"><img src="image/index/alert_2.gif" width="17" height="22"></td>
<td width="40%" height="22"><q style="font-size:10pt;color:#ffffff;cursor:hand;" onclick="javascript:parent.right.location='my_newslist.jsp?lx=<%=lx%>'"><%=lx%>(<%=name%>)</q></td>
<td width="50%" height="22" align="right" colSpan="2"><input size="12" name="keyword">
<!--select name="s1">
<option value="1" selected>标题</option>
<option value="2">关键字</option>
</select-->
<select name="s2">
<option value="all" selected>所有时间</option>
<option value="1">昨天以来</option>
<option value="3">3 天以来</option>
<option value="7">7 天以来</option>
<option value="15">15天以来</option>
<option value="30">30天以来</option>
<option value="60">60天以来</option>
<option value="90">90天以来</option>
</select>
<input type="button" value="搜索" onclick="search();"></td>
<td width="15%" height="22" align=right><%if(only.equals("1")){%><a href="my_newslist.jsp?lx=<%=flx%>"><font color="#ffffff">更多分类<font></a><%}%></td>
<td width="12" height="22">
<div align="right"><img src="image/index/connerx2.gif" width="12" height="22"></div>
</td>
</tr>
</table>
</td>
</tr>
<tr width="100%" valign=top>
<td width="100%" valign=top>
<table valign=top width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="2969B5" style="word-break:break-all;">
<!----------------------------生成二级版面以及下面的文章(双列显示)---------------------------->
<%
for(int kl=0;kl<jnum;kl++){%>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0 valign=top>
<TBODY>
<TR><%if(jmenu2==1){%>
<TD class=c vAlign=top width="95%">
<%}else{%>
<TD class=c vAlign=top width="48%"><%}%>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=15 height=20><IMG height=9 src="oa/images/a3.gif" width=9></TD>
<TD width=75><STRONG><FONT class=f_title><%=(String)((Hashtable)vetmenu2.get(2*kl)).get("MC")%></FONT></STRONG></TD>
<TD><IMG height=20 src="oa/images/line.gif" width=150></TD></TR>
<TR class=bgline1>
<TD colSpan=3 height=1></TD></TR>
<TR>
<TD colSpan=3 height=5 style="LINE-HEIGHT: 130%"></TD></TR></TBODY></TABLE>
<%
//取得文章信息
//System.out.println("my_newslist.jsp"+(String)((Hashtable)vetmenu2.get(2*kl)).get("BH"));
Vector vetmu1 = (Vector)articleBean.getOnePage("where wzlx="+(String)((Hashtable)vetmenu2.get(2*kl)).get("BH")+" order by addtime desc",cur,5);
int jmu1=vetmu1.size();
sum = Integer.parseInt((String)vetmu1.get(0));
String strmu1Id [] = new String[jmu1];
String strmu1title[] = new String[jmu1];//存放文章标题
String strmu1time[] = new String[jmu1];//发表时间
String strmu1Hits[] = new String[jmu1];//取得鼠标提示信息
for(int is=1;is<vetmu1.size();is++)
{
Hashtable hash = (Hashtable)vetmu1.get(is);
strmu1Id[is] = (String)hash.get("ID");
strmu1title[is] = (String)hash.get("TITLE");
strmu1time[is] = ((String)hash.get("ADDTIME")).substring(0,10);
strmu1Hits[is] = ((String)hash.get("HITS"));
}
%>
<%if(jmenu2!=1&&jmu1>intnumconf) jmu1=intnumconf;%>
<%for(int kls=1;kls<jmu1;kls++){%><li><a onclick="view('<%=strmu1Id[kls]%>');" style="cursor:hand;LINE-HEIGHT: 150%" target=_blank title=<%=strmu1Hits[kls]%>><%int len = ds.byteLength(strmu1title[kls]);int len1 = wlen;if(len<wlen+3)len1 = len;String t1 = ds.strByteCopy(strmu1title[kls],len1);%><%=t1%><%if(len>wlen+3)out.print("...");%></a><br><%}%>
<DIV align=right><%if(vetmenu2.size()!=1){%>
<a onclick="changemenu2('<%=(String)((Hashtable)vetmenu2.get(2*kl)).get("MC")%>');" style="cursor:hand;" target=_blank title="更多的信息"> 更多...</a><%}%>
</DIV>
</TD>
<TD width=30></TD>
<%if((2*kl+1<jmenu2)){%>
<TD class=c vAlign=top width="48%">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=15 height=20><IMG height=9 src="oa/images/a3.gif" width=9></TD>
<TD width=75><STRONG><FONT class=f_title><%=(String)((Hashtable)vetmenu2.get(2*kl+1)).get("MC")%></FONT></STRONG></TD>
<TD><IMG height=20 src="oa/images/line.gif" width=150></TD></TR>
<TR class=bgline1>
<TD colSpan=3 height=1></TD></TR>
<TR>
<TD colSpan=3 height=5 style="LINE-HEIGHT: 130%"></TD></TR></TBODY></TABLE>
<%
//取得文章信息
Vector vetmu2 = (Vector)articleBean.getOnePage("where wzlx="+(String)((Hashtable)vetmenu2.get(2*kl+1)).get("BH")+" order by addtime desc",1,5);
int jmu2=vetmu2.size();
String strmu2Id [] = new String[jmu2];
String strmu2title[] = new String[jmu2];//存放文章标题
String strmu2time[] = new String[jmu2];//发表时间
String strmu2Hits[] = new String[jmu2];//取得鼠标提示信息
for(int is=1;is<vetmu2.size();is++)
{
Hashtable hash = (Hashtable)vetmu2.get(is);
strmu2Id[is] = (String)hash.get("ID");
strmu2title[is] = (String)hash.get("TITLE");
strmu2time[is] = ((String)hash.get("ADDTIME")).substring(0,10);
strmu2Hits[is] = ((String)hash.get("HITS"));
}
%>
<%for(int kls=1;kls<jmu2;kls++){%><li><a onclick="view('<%=strmu2Id[kls]%>');" style="cursor:hand;LINE-HEIGHT: 150%" target=_blank title=<%=strmu2Hits[kls]%>><%int len = ds.byteLength(strmu2title[kls]);int len1 = wlen;if(len<wlen+3)len1 = len;String t1 = ds.strByteCopy(strmu2title[kls],len1);%><%=t1%><%if(len>wlen+3)out.print("...");%></a><br><%}%>
<DIV align=right>
<a onclick="changemenu2('<%=(String)((Hashtable)vetmenu2.get(2*kl+1)).get("MC")%>');" style="cursor:hand;" target=_blank title="更多的信息"> 更多...</a>
</DIV>
</TD><TD width=30> </TD>
<%}%><!-- if_else_end--------------->
</TR>
</TBODY></TABLE>
<%}%><!--for_end 二级版面以及文章生成结束------------------------------------>
</table>
</td>
</tr>
<TR>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="2969B5">
<td width="12" height="22"><img src="image/index/connerx3.gif" width="12" height="22"></td>
<TD align=right bgColor=#2969B5 height=22> <%if(jmenu2==1){%><font color=white>当前<%=cur%>/<%=sum%>页   <a onclick="gotopage('1')" style="cursor:hand;">第一页    </a>
<%if(cur>1){int t=cur-1;%><a onclick="gotopage('<%=t%>')" style="cursor:hand;">上一页    </a><%}%>
<%if(cur<sum){int s=cur+1;%><a onclick="gotopage('<%=s%>')" style="cursor:hand;">下一页   </a><%}%>
<a onclick="gotopage('<%=sum%>')" style="cursor:hand;">最后页    </a>
直接<input type=image src="oa/images/hand.gif" name="gotof" onclick="return checkdata();">
<input type=text size=2 name=bm class=formcolor>页</font><%}else{%> <%}%></TD>
<td width="12" height="22">
<div align="right"><img src="image/index/connerx4.gif" width="12" height="22"></div>
</td>
</tr>
</table>
</TR>
</table>
<script>
function isDigit(str)
{
var bool = true;
for(var i=0;i<str.length;i++)
{
if(!(str.charAt(i)>=0&&str.charAt(i)<=9))
{
bool = false;
break;
}
}
return bool;
}
function checkdata()
{
if(!isDigit(document.all.bm.value))
{
alert("输入的页码不是数字!");
document.all.bm.value="";
return false;
}
if(document.all.bm.value=="")
{
alert("请输入页码!");
document.all.bm.value="";
return false;
}
else
{
var t = document.all.bm.value;
var cur = "<%=cur%>";
var sum = "<%=sum%>";
while(t.length>cur.length)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
if(t==cur){return false;}
while(t.length>sum.length)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
if(t<1||t>sum)
{
alert("请跳至1和"+sum+"之间!");
document.all.bm.value="";
return false;
}
}
window.parent.right.location = "my_newslist.jsp?bm="+document.all.bm.value+"&lx=<%=lx%>";
}
function gotopage(id)
{
window.parent.right.location = "my_newslist.jsp?bm="+id+"&lx=<%=lx%>&only=1";
}
function view(id)
{
window.parent.right.location = "my_newsread.jsp?id="+id+"&lx=<%=lx%>";
}
function changemenu2(type)
{
if(type!="其他")
window.parent.right.location = "my_newslist.jsp?lx="+type+"&only=1";
else
window.parent.right.location = "my_newslist.jsp?lx=<%=lx%>"+"&only=1";
}
function search()
{//按标题搜索
window.location = "searchResult.jsp?keyword="+document.all.keyword.value+"&title_kw=1&time="+document.all.s2.value+"&lx=<%=strlx%>&only=<%=stronly%>";
}
</script>
<%}finally{
myBean.closeConn();
articleBean.closeConn();
orgmenuBean.closeConn();
newsBean.closeConn();
}%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -