⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_newsread.jsp

📁 运用JSP+tomcat及各种数据库编辑的一些较常用的应用程序
💻 JSP
字号:
<%
/**********************************************************
Copyright (C),2003-11-2, Beijing  USTB.
All rights reserved.
Filename: viewnews.jsp
Author: 
Version 1.0
Date:2003-11-2
Description:公司主页:显示新闻详细信息
Other:
Variable List:

Function List:

History:
***********************************************************/
%>
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*"%>


<%
oa.bean.PersonBean	myBean1 = null;
oa.bean.MynewsBean	newsBean = null;
oa.bean.MainBean	myBean = null;
oa.bean.OrgMenuBean orgmenuBean = null;

try{
	myBean1 = new oa.bean.PersonBean();
	newsBean = new oa.bean.MynewsBean();
	myBean = new oa.bean.MainBean();
	orgmenuBean = new oa.bean.OrgMenuBean();

	if ( myBean.getConn() == null
		|| myBean1.getConn() == null
		|| newsBean.getConn() == null
		|| orgmenuBean.getConn() == null)
	{
		%>		
		数据库无法响应,请<a href="javascript:window.history.back(-1);">返回</a>重试
		<%out.close();
	}
    oa.main.DealString ds = new oa.main.DealString();

	String uid = (String)session.getAttribute("zgbh");

	myBean1.setPersonNO(uid.trim());
//	String name = myBean1.getPsBmName();
	String bmbh = myBean1.getBMBH();
	String name = myBean1.getFatherName(bmbh);//strOrgNO
	String strOrgNO = myBean1.getOrgNO();
	if(name.equals(""))
		name = myBean1.getPsBmName();
	else
		name = name.substring(0,name.length()-1);

	String lx = ds.toGBK(ds.toString(request.getParameter("lx")));
	
	newsBean.setUID(uid);

	String strFileId = ds.toString((String)request.getParameter("id"));
	if(strFileId.equals(""))strFileId = "0";
	
	//增加访问次数
	myBean.addTime(strFileId);

//(3)取得文章编号
	String appendix="0";
	String ftp = "0";
	String pathappendix= oa.main.ParentBean.FilesPath + "news/appendix/";
	pathappendix = (new oa.main.DealString()).Replace(pathappendix,"\\","/");
	String path= oa.main.ParentBean.FilesPath + "news/img/";
	path = (new oa.main.DealString()).Replace(path,"\\","/");
	String strftpsite=myBean.getftpsite()+"/";
	String strtitle ="";
	String strfrom = "";
	String strwriter= "";
	String straddtime = "";
	String strtimes = "";
	String strcontent ="";
	String strOrgid = "";
	String strpic ="";
	String strftp ="";
	String strauthor = "";
	String strOldOrgid="";
	if(!strFileId.equals("0"))
	{	
		Hashtable hash = (Hashtable)myBean.getOneNews(strFileId);
	
		strtitle = (String)hash.get("TITLE");
		strfrom = (String)hash.get("FROMSITE");
		strwriter= myBean.toName("ZZ_ZGB","ZGBH","XM",(String)hash.get("WRITER"));
		straddtime = (String)hash.get("ADDTIME");
		strtimes = (String)hash.get("TIMES");
		strcontent = myBean.getOneContent(strFileId);
		strOrgid = (String)hash.get("ORGID");
		strpic = (String)hash.get("IMG");
		strftp = (String)hash.get("FTPFILE");
		strauthor = (String)hash.get("AUTHOR");
		strOldOrgid = (String)hash.get("OLDORGID");
	}
	String strOrgids[] = strOrgid.split(",");
	String strOldOrgids[] = strOldOrgid.split(",");
	String strftps[] = strftp.split(",");
	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();
	
	//对于已经发布的文章进行特殊处理
	String confdir = oa.main.ParentBean.FilesPath;
	confdir = (new oa.main.DealString()).Replace(confdir,"\\","/");
	String ip = "http://"+request.getServerName();
	String port = request.getServerPort()+"";
	if(!port.equals("80"))ip+=":"+port;
	strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/hg/oa/manage/upload/img/","photo.jsp?photo="+confdir+"news/img/");
	strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/hg/oa/manage/upload/appendix/",confdir+"news/appendix/");
	strcontent = (new oa.main.DealString()).Replace(strcontent,"/hg/temp_sure/","/hg/downloadservlet?type=1&&filename=temp_sure/");

	ip = "http://10.0.0.92";
	strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/hg/oa/manage/upload/img/","photo.jsp?photo="+confdir+"news/img/");
	strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/hg/oa/manage/upload/appendix/",confdir+"news/appendix/");
	strcontent = (new oa.main.DealString()).Replace(strcontent,"/hg/temp_sure/","/hg/downloadservlet?type=1&&filename=temp_sure/");

 strcontent = (new oa.main.DealString()).Replace(strcontent,"photo.jsp?photo=","../../PhotoServlet?photo=news/img/");
%>
<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">
<div align="center">
<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="50%" 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><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 bgcolor="#F2F2F2">
	<table width="100%" border="0">
		<tr> 
		<td height="40" align="center"><font style="font-size:16px"><b><%=strtitle%></b></font></td>
		</tr>
		<tr>
		<td align="right"><font color="#999999">来源:<%=strfrom%><font color="#CC0000"></font> 
			发布时间:<%=straddtime%></font>&nbsp;&nbsp;</td>
		</tr>
		</table> 
	<br>
    <table width="100%" border="0" cellspacing=0 cellpadding="4">
        <tr><td align=center>
		<table width="96%" border="0" cellspacing=0 cellpadding="0" style="word-break:break-all;">
		<tr><td><p><font id="zoom"><%=strcontent%></font></p></td><tr>
		</table>
		</td>
		</tr>
		<tr><td align="right">编辑:<%=strauthor%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;被访问次数:<%=strtimes%>&nbsp;&nbsp;</td><tr>

        
		<tr><td bgcolor="#dddddd">【 附件下载】</td></tr>
		<tr>
				<td>
			<font color=#CC0066>附件:
<%
	for (int i=0;i<strOrgids.length;i++){
		if(!strOrgids[i].equals("")){
%>
			<a href="articledownloadservlet?newname=<%=strOrgids[i]%>&newfile=<%=strOldOrgids[i]%>"><%=strOldOrgids[i]%></a></font>;
<%
		}
		else out.print("没有附件"); 
	}
%>		
		</td>
		</tr>
    	<!--tr><td bgcolor="#dddddd">【 FTP下载】</td></tr>
		<tr>
			 <%/*for(int i=0;i<strftps.length;i++)
				  {	
				   if(!strftps[i].equals(""))*/
				//	{//ftp="1";%>
						<td bgcolor="#eeeeee"><a target='_blank' href=<%//=strftpsite--%><%//=strftps[i]%>><li>下载</li><%//=i+1%></a></td>
					<%//}
			  // }
			  // if(ftp.equals("0")){%><td bgcolor="#eeeeee">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;没有FTP文件</td><%//}%>
		 </tr-->
	</table>

		    <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 height="22" align=right><script language=JavaScript>
				<!-- Begin
				if (window.print) {
				document.write('<font color=#ffffff>【</font><a href="#" onClick="javascript:parent.right.print()"><font color=#ffffff>打印本文</font></a><font color=#ffffff>】</font>');
				}
				// End -->
				</script>
				  <font color=#ffffff>【</font> <a href="javascript:doZoom(16)"><font color=#ffffff>大</font></a> 
				  <a href="javascript:doZoom(14)"><font color=#ffffff>中</font></a> 
				  <a href="javascript:doZoom(12)"><font color=#ffffff>小</font></a><font color=#ffffff>】</font>
			  </td>
			  <td width="12" height="22">
				<div align="right"><img src="image/index/connerx4.gif" width="12" height="22"></div>
			  </td>
			</tr>
			</table>
    
	</td>
</tr>
</table>
</div>
<br>
<script>
	function doZoom(size)
	{
		document.getElementById('zoom').style.fontSize=size+'px'
	}

</script>

<%}
finally{
orgmenuBean.closeConn();
myBean1.closeConn();
myBean.closeConn();
newsBean.closeConn();
}%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -