小说网站的源码设计实现 |
您所在的位置:网站首页 › html网站首页制作代码怎么写 › 小说网站的源码设计实现 |
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代码 [html] view plain copy 校园小说页面_校园网 当前位置 : 首页 >> 个人主页>>小说 小说 按类型: 全部 ${xiaoshuotype.name } 按更新: 全部 连载中 已完结 首页 上一页 下一页 尾页 第${pageNow }页共${PageCount }页${allrows }部小说 ${xiaoshuo.title } 2、小说详情页面html代码 [html] view plain copy 校园小说页面_校园网 当前位置 : 首页 个人主页小说 小说 ${xiaoshuo.title } 类型 : ${xiaoshuo.xiaoshuotype.name } 状态 : 连载中 已完结 更新 : ${xiaoshuo.creTime } 返回 点击次数 : ${xiaoshuo.click } 推荐率 : ${fn:length(userxiaoshuoreco) } 章数 : ${count }章 文档 : txt 点击阅读 查看目录 加入书架 已在书架 我的书架 投推荐票 已推荐 描述: ${xiaoshuo.content } 3、小说章数目录页面 [html] view plain copy 校园小说页面_校园网 当前位置 : 首页 个人主页小说 小说 返回 ${xiaoshuo.title } 第${i}章 4、小说内容阅读页面 [html] view plain copy 校园新小说页面_校园网 当前位置 : 首页 个人主页小说 小说 ${xiaoshuo.title } ${str } 上一章 目录 下一章 相关java代码 [html] view plain copy 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(pageNowsPageCount) { pageNows=PageCount; } //获取小说 List xiaoshuos=userService.executeQueryByPage("from Xiaoshuo order by id desc", null, pageNows, PagesSize); //获取小说分类 List 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 xiaoshuos=universityService.executeQueryByPage("from Xiaoshuo where state=1 order by id desc", null, pageNow, pageSize); } //获取已完结的小说 else if("wanjie".equals(xiaoshuotypeid)){ List 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(pageNowsPageCount) { pageNows=PageCount; } List xiaoshuos=userService.executeQueryByPage("from Xiaoshuo where xiaoshuotype.id=? order by id desc", new Object[]{Integer.valueOf(id)}, pageNows, PagesSize); List 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(count1count) { count1=count; } if(count1 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |