仿360小说网站的源码设计实现

8 篇文章 0 订阅
2 篇文章 0 订阅

360首页检索小说效果如下:

个人完成编写的schoolnet校园网主页如下

 

在小说模块中,包括:小说类别编号:a、校园爱情    b、动漫同人    c、校园魔法    d、轻小说    e、校园励志    f、校园修真    g、名人传记    h、古典小说    i、 国外小说。小说状态:a、连载中  b、已完结。用户可以阅读完整小说、添加小说进入书架、查看目录、投推荐票(限制只能投一次),用户有权管理自己的书架。

页面效果如下:

1、

2、

3、

4、

5、

数据库相关表设计:

xiaoshuo小说表:包含主键id、小说类别编号typeid、小说状态state、小说标题title、小说文档docu、小说推荐率recommend、点击次数click、小说描述content、更新时间creTime、小说封面photo等。
xiaoshuotype小说分类表:包含主键id、类别名称name。
bookrack书架表:包含主键id、用户userid、小说xiaoshuoid。

votereco小说推荐投票表:包含主键id、用户userid、小说xiaoshuoid

1、小说主页面html代码

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="Keywords" content="个人主页、说说、相册、好友、日志、音乐、新闻、新鲜事" />
<meta name="Description"
	content="超酷的校园网、校园交友平台,创新的校园资源获取与分、专注打造最好的校园真实社交网络!" />
<title>校园小说页面_校园网</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="../public/head.jsp" />
		<div id="page_main" class="clearfix">
			<div class="page-right">
				<div class="site-nav">
					<span>当前位置 : </span><a href="/schoolnet/login.do?flag=goIndexUI">首页</a>
					>> <a href="/schoolnet/login.do?flag=goHomeUI" title="">个人主页</a>>>小说
				</div>
				<div class="page-news">
					<div class="content">
						<div class="mes_response" id="mes_response">
							<table>
								<tr>
									<th class="news-time">小说</th>
								</tr>
								<tr>
									<td><p>按类型:</p>
										<div id="clearClass" class="pages" style="margin-top:-10px">
											<a class="current" href="javascript:void(0)"
												onclick="setXiaoshuotype(this)" name="all" title="1">全部
											</a>
											<c:forEach var="xiaoshuotype" items="${xiaoshuotypes }">
												<a href="javascript:void(0)" onclick="setXiaoshuotype(this)"
													name="${xiaoshuotype.id }" title="1">${xiaoshuotype.name
													}</a>
											</c:forEach>
										</div>
										<tr>
											<td><br />
												<p>按更新:</p>
												<div id="clearClass2" class="pages">
													<a href="javascript:void(0)"
														onclick="setXiaoshuotype3(this)" name="all" title="1"
														class="current">全部</a> <a href="javascript:void(0)"
														onclick="setXiaoshuotype3(this)" name="lianzai" title="1">
														连载中</a> <a href="javascript:void(0)"
														onclick="setXiaoshuotype3(this)" name="wanjie" title="1">
														已完结</a>
												</div></td>
										</tr>
										<tr>
											<td>
												<div id="showxiaoshuos">
													<div id="ajaxpage" class="pages" style="width:100%">
														<a href="javascript:void(0)"
															onclick="setXiaoshuotype2(this)" name="all" title="1"
															class="current"> 首页 </a> <a href="javascript:void(0)"
															onclick="setXiaoshuotype2(this)" name="all"
															title="${pageNow-1 }" class="current"> 上一页 </a> <a
															href="javascript:void(0)"
															onclick="setXiaoshuotype2(this)" name="all"
															title="${pageNow+1 }" class="current"> 下一页 </a> <a
															href="javascript:void(0)"
															onclick="setXiaoshuotype2(this)" name="all"
															title="${PageCount }" class="current"> 尾页 </a> <a
															class="current2">第${pageNow }页</a><a class="current2">共${PageCount
															}页</a><a class="current2">${allrows }部小说</a>
													</div>
													</br>
													<c:forEach var="xiaoshuo" items="${xiaoshuos }">
														<div class="xiaoshuos">
															<a
																href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodescript&pageNow=1&id=${xiaoshuo.id }"
																title="${xiaoshuo.title }"> <img
																src="/schoolnet/Media/txt/photo/${xiaoshuo.photo }"
																width="104px" height="150px">
															</a>
															<p class="ellipsis">
																<a
																	href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodescript&pageNow=1&id=${xiaoshuo.id }"
																	title="${xiaoshuo.title }">${xiaoshuo.title }</a>
															</p>
														</div>
													</c:forEach>
												</div></td>
										</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<jsp:include page="../public/foot.jsp" />
	</div>
</body>
</html>

2、小说详情页面html代码

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="Keywords" content="个人主页、说说、相册、好友、日志、音乐、新闻、新鲜事" />
<meta name="Description"
	content="超酷的校园网、校园交友平台,创新的校园资源获取与分、专注打造最好的校园真实社交网络!" />
<title>校园小说页面_校园网</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="../public/head.jsp" />
		<div id="page_main" class="clearfix">
			<div class="page-right">
				<div class="site-nav">
					<span>当前位置 : </span><a href="/schoolnet/login.do?flag=goIndexUI">首页</a>
					<a href="/schoolnet/login.do?flag=goHomeUI" title="">个人主页</a>小说
				</div>
				<div class="page-news">
					<div class="content">
						<div class="mes_response" id="mes_response">
							<table>
								<tr>
									<th class="news-time">小说</th>
								</tr>
								<tr>
									<td>
										<div>
											<div style="float:left">
												<a href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodescript&pageNow=1&id=${xiaoshuo.id }"
													title="${xiaoshuo.title }"> <img src="/schoolnet/Media/txt/photo/${xiaoshuo.photo }"
													width="104px" height="150px"> <br />${xiaoshuo.title }</a>
											</div>
											<div style="float:left;padding-left:20px">
												<div style="float:left;">
													<p>类型 : ${xiaoshuo.xiaoshuotype.name }</p>
													<p> 状态 : 
														<c:if test="${xiaoshuo.state==1 }">连载中</c:if>
														<c:if test="${xiaoshuo.state==2 }">已完结</c:if>
													</p>
													<p>更新 : ${xiaoshuo.creTime }</p>
													<p>
														<span class="pages"> <a class="current" href="javascript:void(0)"
															onclick="javascript:window.history.go(-1)">返回</a> </span>
													</p>
												</div>
												<div style="float:left;padding-left:20px">
													<p>点击次数 : ${xiaoshuo.click }</p>
													<p>推荐率 : ${fn:length(userxiaoshuoreco) }</p>
													<p>章数 : ${count }章</p>
													<p>文档 : txt</p>
												</div>
											</div>
										</div></td>
								</tr>
								<tr>
									<td><input id="xiaoshuoid" value="${xiaoshuo.id }"
										type="hidden"> <input id="userid"
											value="${loginuser.id }" type="hidden">
												<div class="pages">
													<a class="current" href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodisplay&pageNow=1&id=${xiaoshuo.id }">点击阅读</a>
													<a class="current" href="/schoolnet/xiaoshuo.do?flag=goxiaoshuoshowUI&pageNow=1&id=${xiaoshuo.id }"
														title="${xiaoshuo.title }">查看目录</a>
													<c:if test="${userxiaoshuo==null }">
														<span id="setbooks"><a href="javascript:void(0);"
															onclick="setBooks()" title="加入书架" class="current"
															style="background:#1093d7;">加入书架</a>
														</span>
													</c:if>
													<c:if test="${userxiaoshuo!=null }">
														<a title="已在书架" class="current" style="background:#999;">已在书架</a>
													</c:if>
													<a href="/schoolnet/xiaoshuo.do?flag=gomyxiaoshuoUI&pageNow=1"
														class="current">我的书架</a>
													<c:if test="${userxiaoshuoreco==null }">
														<span id="setreco"><a href="javascript:void(0);"
															class="current" onclick="setreco()">投推荐票</a>
														</span>
													</c:if>
													<c:if test="${userxiaoshuoreco!=null }">
														<a title="已推荐" class="current" style="background:#999;">已推荐</a>
													</c:if>
												</div>
												<p>描述:</p>
												<p>${xiaoshuo.content }</p>
									</td>
								</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<jsp:include page="../public/foot.jsp" />
	</div>
</body>
</html>

3、小说章数目录页面

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="Keywords" content="个人主页、说说、相册、好友、日志、音乐、新闻、新鲜事" />
<meta name="Description"
	content="超酷的校园网、校园交友平台,创新的校园资源获取与分、专注打造最好的校园真实社交网络!" />
<title>校园小说页面_校园网</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="../public/head.jsp" />
		<div id="page_main" class="clearfix">
			<div class="page-right">
				<div class="site-nav">
					<span>当前位置 : </span><a href="/schoolnet/login.do?flag=goIndexUI">首页</a>
					<a href="/schoolnet/login.do?flag=goHomeUI" title="">个人主页</a>小说
				</div>
				<div class="page-news">
					<div class="content">
						<div class="mes_response" id="mes_response">
							<table>
								<tr><th class="news-time">小说</th> </tr>
								<tr>
									<td><span class="pages"> <a class="current"
											href="javascript:void(0)"
											onclick="javascript:window.history.go(-1)">返回</a> </span> <span
										style="margin-left:220px">${xiaoshuo.title }</span></td>
								</tr>
								<tr>
									<td class="pages"><c:forEach var="i" begin="1"
											end="${count}">
											<a class="pagesa" href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodisplay&pageNow=${i }&id=${xiaoshuo.id}">第${i}章</a>
										</c:forEach></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<jsp:include page="../public/foot.jsp" />
	</div>
</body>
</html>

4、小说内容阅读页面

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="Keywords" content="个人主页、说说、相册、好友、日志、音乐、新闻、新鲜事" />
<meta name="Description" content="超酷的校园网、校园交友平台,创新的校园资源获取与分、专注打造最好的校园真实社交网络!" />
<title>校园新小说页面_校园网</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="../public/head.jsp" />
		<div id="page_main" class="clearfix">
			<div class="page-right">
				<div class="site-nav">
					<span>当前位置 : </span><a href="/schoolnet/login.do?flag=goIndexUI">首页</a>
					  <a href="/schoolnet/login.do?flag=goHomeUI" title="">个人主页</a>小说
				</div>
				<div class="page-news">
					<div class="content">
						<div class="mes_response" id="mes_response">
							<table>
								<tr><th class="news-time">小说 </th></tr>
								<div class="pages" style="margin-left:200px;">        
								</div>
								<tr> <td align="center"><span>${xiaoshuo.title }</span> </td> </tr>
								<tr>
								<td>${str }
								</td> </tr>
							</table>
						</div>
					 <div class="pages" style="margin-left:200px;">
						<a href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodisplay&pageNow=${page-1 }&id=${xiaoshuo.id}"
						   class="current"> 上一章 </a> 
						<a href="/schoolnet/xiaoshuo.do?flag=goxiaoshuoshowUI&pageNow=${page }&id=${xiaoshuo.id}"
						   class="current"> 目录</a> 
						<a href="/schoolnet/xiaoshuo.do?flag=goxiaoshuodisplay&pageNow=${page+1 }&id=${xiaoshuo.id}"
						   class="current"> 下一章</a> 
					  </div>
					</div>
				</div>
			</div>
		</div>
		<jsp:include page="../public/foot.jsp" />
	</div>
</body>
</html>

相关java代码

 

 

		int PagesSize=10;
		String pageNow=request.getParameter("pageNow");
		String id=request.getParameter("id");

		//选择小说类型为全部
		if("all".equals(id)){

		//分页查询
			int pageNows=Integer.valueOf(pageNow);
			int allrows=userService.queryallrows("from Xiaoshuo", null);
			int PageCount=(allrows-1)/PagesSize+1;
			if(pageNows<1)
			{
				pageNows=1;
			}
			if(pageNows>PageCount)
			{
				pageNows=PageCount;
			}

			//获取小说
			List<Xiaoshuo> xiaoshuos=userService.executeQueryByPage("from Xiaoshuo order by id desc", null, pageNows, PagesSize);
			
			//获取小说分类			
			List<Xiaoshuotype> xiaoshuotypes=userService.getResult("from Xiaoshuotype", null);
			request.setAttribute("xiaoshuotypes", xiaoshuotypes);
			request.setAttribute("xiaoshuos", xiaoshuos);
			request.setAttribute("pageNow", pageNows);
			request.setAttribute("PageCount", PageCount);
			request.setAttribute("allrows", allrows);
		}

		//获取连载中的小说
		else if("lianzai".equals(xiaoshuotypeid)){
			List<Xiaoshuo> xiaoshuos=universityService.executeQueryByPage("from Xiaoshuo where state=1 order by id desc", null, pageNow, pageSize);
		}
		//获取已完结的小说
		else if("wanjie".equals(xiaoshuotypeid)){
			List<Xiaoshuo> xiaoshuos=universityService.executeQueryByPage("from Xiaoshuo where state=2 order by id desc", null, pageNow, pageSize);
		}
		//选择小说类型为单类
		else {
			int pageNows=Integer.valueOf(pageNow);
			int allrows=userService.queryallrows("from Xiaoshuo where xiaoshuotype.id=?", new Object[]{Integer.valueOf(id)});
			int PageCount=(allrows-1)/PagesSize+1;
			if(pageNows<1)
			{
				pageNows=1;
			}
			if(pageNows>PageCount)
			{
				pageNows=PageCount;
			}
			List<Xiaoshuo> xiaoshuos=userService.executeQueryByPage("from Xiaoshuo where xiaoshuotype.id=? order by id desc", new Object[]{Integer.valueOf(id)}, pageNows, PagesSize);
			List<Xiaoshuotype> xiaoshuotypes=userService.getResult("from Xiaoshuotype", null);
			request.setAttribute("xiaoshuotypes", xiaoshuotypes);
			request.setAttribute("xiaoshuos", xiaoshuos);
			request.setAttribute("pageNow", pageNows);
			request.setAttribute("PageCount", PageCount);
			request.setAttribute("allrows", allrows);
		}

     String id=request.getParameter("id");
     Xiaoshuo xiaoshuo=(Xiaoshuo) userService.findById(Xiaoshuo.class, Integer.valueOf(id));
     request.setAttribute("xiaoshuo", xiaoshuo);
     String docu=xiaoshuo.getDocu();
     StringBuffer sb=GetContent.uploadHead(request,docu);
     Pattern p = Pattern.compile("第[一二三四五六七八九十百千]{5}章 ");
     Matcher m = p.matcher(sb);
     int count =0;
     int count1=Integer.valueOf(request.getParameter("pageNow"));
     while(m.find()){
           count ++;
     }
 	if(count1<1)
	{
 		count1=1;
	}
	if(count1>count)
	{
		count1=count;
	}
     if(count1<=count)
     {
	 //将阿拉伯数值转成中文数值
    	 String result=ChinUtil.toChin(String.valueOf(count1));
    	 String result2=ChinUtil.toChin(String.valueOf(count1+1));
	 //截取两章之间的内容
         String sb1=sb.toString().substring(sb.indexOf("第"+result+"章"), sb.indexOf("第"+result2+"章"));
         request.setAttribute("str", sb1);
         request.setAttribute("page", count1);
     }
     request.setAttribute("count", count);

 

GetContent.java

 

public class GetContent {
	public static StringBuffer uploadHead(HttpServletRequest request,String docu){
		StringBuffer sb = new StringBuffer();
		 try{
			//filePath就是当前这个web应用是绝对路径 
			 String filepath=request.getSession().getServletContext().getRealPath("/");
			File f2=new File(filepath+"\\Media\\txt\\"+docu);
			BufferedReader bReader=new BufferedReader(new FileReader(f2));
			while (true) {
				String str = bReader.readLine();
				if (str != null) {
						sb.append(str + "<br/>");
				}
				if (str == null) {
					break;
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		 return sb;
		}
}

ChinUtil.java

 

 

public class ChinUtil{
		public static String toChin(String string) {
		    String nums[]={"0","1","2","3","4","5","6","7","8","9"};
			String chines[]={"零","一","二","三","四","五","六","七","八","九"};
			String level[]={"十","百","千","万","十","百","千","亿"};
			//不算进制,直接将阿拉伯数值转中文数字
			for (int i = 0; i < nums.length; i++) {
				string=string.replaceAll(nums[i], chines[i]);
			}
			System.out.println(string);
			StringBuffer stringBuffer=new StringBuffer(string);
			//插入十进制单位
			for (int i = 0; i < string.length()-1; i++) {
				stringBuffer.insert(string.length()-1-i, level[i]);
			}
			System.out.println(stringBuffer.toString());
			String temp = new String(stringBuffer.toString());
			//处理零的情况
			while((temp.indexOf("零万")!=-1)||(temp.indexOf("零千")!=-1)||(temp.indexOf("零百")!=-1)||(temp.indexOf("零十")!=-1)||(temp.indexOf("零零")!=-1)){
			   if(temp.indexOf("零千")!=-1){
			   temp = temp.replaceAll("零千","零");
			   }
			   if(temp.indexOf("零百")!=-1){
			   temp = temp.replaceAll("零百","零");
			   }
			   if(temp.indexOf("零十")!=-1){
			   temp = temp.replaceAll("零十","零");
			   }
			   if(temp.indexOf("零零")!=-1){
			   temp = temp.replaceAll("零零","零");
			   }
			  
			  if((temp.indexOf("零万")!=-1)){
			   temp = temp.replaceAll("零万","万");
			  }
			     }
			  //处理个位为零的情况
			  if(temp.lastIndexOf("零")==temp.length()-1){
			   temp = temp.substring(0,temp.length()-1);
			  }
			 return temp;
	 }
}

其他相关文章

自制仿360首页支持拼音输入全模糊搜索和自动换肤

自制仿酷我音乐专辑模块源码实现

lucene对校园网资料的全文检索

### 回答1: Python仿360安全卫士的Web源码是一个全栈项目,主要利用Python技术实现360安全卫士的在线扫描和安全防护功能。此项目旨在提供一个可靠的安全防护工具,为网络用户提供便捷的在线安全服务。 此Web源码主要采用了Python的Django框架,利用了Django的快速开发特性,实现Web服务的快速搭建。同时,项目还采用了Docker容器技术,使得部署和管理更加简单和便捷,提高了项目的可移植性和易用性。 此Web源码实现了多种安全扫描功能,包括恶意文件扫描、漏洞扫描、网站监控等。其原理是通过各种扫描引擎的API接口和底层算法,对用户提供的URL和文件进行分析和检查,识别出其中的安全风险,并提供相应的处理方案。同时,还提供了一系列的安全防护功能,如攻击防御、网站加固等,以保护用户的网络安全。 总体来说,此Web源码是一个功能强大、易安装、易使用、高效可靠的Web安全服务,对于有一定网络安全基础的用户来说,是一个不可多得的学习和使用资源。 ### 回答2: 对于python仿360安全卫士web源码的回答,可以从以下几个方面进行描述: 首先,360安全卫士是一款知名的杀毒软件,旨在保护用户电脑的安全。在使用python仿360安全卫士web源码的过程中,需要了解360安全卫士的基本功能和特点。这些功能包括病毒查杀、木马查杀、清理垃圾、优化系统等。 在源码的编写过程中,可以使用python的Web框架,比如Django或者Flask。这些框架提供了快速开发web应用的功能,能够简化开发过程。可以利用框架的路由机制,实现用户输入网址后的页面跳转。通过模板引擎,结合HTML、CSS、JavaScript等前端技术,构建用户界面,使其看起来更加美观和友好。 对于病毒查杀功能,可以通过调用第三方杀毒API库实现。这些API可以根据病毒特征库来判断文件是否感染病毒,并给出相应的处理建议。可以在web界面上展示病毒查杀的结果,并提供操作选项,比如删除或隔离病毒文件。 对于系统优化功能,可以通过调用系统命令或者第三方库来实现。可以通过python获取系统的资源信息,比如CPU、内存等使用情况,根据这些信息判断系统的性能状况,并给出优化建议。可以在web界面上展示系统优化的结果,并提供相应的操作选项。 另外,还可以增加用户注册、登录、数据存储和管理等功能,使得仿360安全卫士的web应用具有更好的用户体验和交互性。 总结起来,通过使用python的Web框架、第三方库和各种资源,可以实现仿360安全卫士的web源码。在编写过程中,需要了解360安全卫士的基本功能,并根据需求进行模块划分、功能实现和界面设计,以达到实现目标。
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zz_cl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值