Java项目:jsp+servlet实现的新闻发布系统

news2024/11/28 10:49:08

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目分为前后台;
前台主要功能为:
首页、娱乐新闻、经济新闻、文化新闻、小道新闻、用户评价等;

后台主要功能为:
可以对新闻类别,新闻,新闻评论,友情链接等进行数据管理
 

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
5.数据库:MySql 5.7版本;

6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

技术栈

1. 后端:servlet

2. 前端:JSP+css+javascript

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中news.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/News
后台地址:http://localhost:8080/News/user?action=login

用户名:admin,密码:123456

运行截图

前台界面

后台界面

相关代码 

CommentServlet

package com.java1234.web;

import java.io.IOException;
import java.sql.Connection;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONObject;

import com.java1234.dao.CommentDao;
import com.java1234.model.Comment;
import com.java1234.model.PageBean;
import com.java1234.util.DbUtil;
import com.java1234.util.NavUtil;
import com.java1234.util.PageUtil;
import com.java1234.util.PropertiesUtil;
import com.java1234.util.ResponseUtil;
import com.java1234.util.StringUtil;

public class CommentServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	DbUtil dbUtil=new DbUtil();
	CommentDao commentDao=new CommentDao();
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String action=request.getParameter("action");
		if("save".equals(action)){
			commentSave(request,response);
		}else if("backList".equals(action)){
			commentBackList(request,response);
		}else if("delete".equals(action)){
			commentDelete(request,response);
		}
		
	}
	
	private void commentSave(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String newsId=request.getParameter("newsId");
		String content=request.getParameter("content");
		String userIP=request.getRemoteAddr();
		Comment comment=new Comment(Integer.parseInt(newsId), content, userIP);
		Connection con=null;
		try{
			con=dbUtil.getCon();
			commentDao.commentAdd(con, comment);
			request.getRequestDispatcher("news?action=show&newsId="+newsId).forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private void commentBackList(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String s_bCommentDate=request.getParameter("s_bCommentDate");
		String s_aCommentDate=request.getParameter("s_aCommentDate");
		String page=request.getParameter("page");
		HttpSession session=request.getSession();
		if(StringUtil.isEmpty(page)){
			page="1";
			session.setAttribute("s_bCommentDate", s_bCommentDate);
			session.setAttribute("s_aCommentDate", s_aCommentDate);
		}else{
			s_bCommentDate=(String) session.getAttribute("s_bCommentDate");
			s_aCommentDate=(String) session.getAttribute("s_aCommentDate");
		}
		Connection con=null;
		try{
			con=dbUtil.getCon();
			int total=commentDao.commentCount(con, new Comment(), s_bCommentDate, s_aCommentDate);
			String pageCode=PageUtil.getPagation(request.getContextPath()+"/comment?action=backList", total, Integer.parseInt(page), Integer.parseInt(PropertiesUtil.getValue("backPageSize")));
			PageBean pageBean=new PageBean(Integer.parseInt(page),Integer.parseInt(PropertiesUtil.getValue("backPageSize")));
			List<Comment> commentBackList=commentDao.commentList(con, new Comment(),pageBean,s_bCommentDate,s_aCommentDate);
			request.setAttribute("pageCode", pageCode);
			request.setAttribute("commentBackList", commentBackList);
			request.setAttribute("navCode", NavUtil.genNewsManageNavigation("新闻评论管理", "新闻评论维护"));
			request.setAttribute("mainPage", "/background/comment/commentList.jsp");
			request.getRequestDispatcher("/background/mainTemp.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	
	private void commentDelete(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String commentIds=request.getParameter("commentIds");
		Connection con=null;
		try{
			con=dbUtil.getCon();
			JSONObject result=new JSONObject();
			int delNums=commentDao.commentDelete(con, commentIds);
			if(delNums>0){
				result.put("success", true);
				result.put("delNums", delNums);
			}else{
				result.put("errorMsg", "删除失败");
			}
			ResponseUtil.write(result, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}

IndexServlet

package com.java1234.web;

import java.io.IOException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.java1234.dao.LinkDao;
import com.java1234.dao.NewsDao;
import com.java1234.dao.NewsTypeDao;
import com.java1234.model.Link;
import com.java1234.model.News;
import com.java1234.model.NewsType;
import com.java1234.util.DbUtil;
import com.java1234.util.StringUtil;

public class IndexServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	DbUtil dbUtil=new DbUtil();
	NewsDao newsDao=new NewsDao();
	NewsTypeDao newsTypeDao=new NewsTypeDao();
	LinkDao linkDao=new LinkDao();

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		
		Connection con=null;
		try{
			con=dbUtil.getCon();
			
			List<NewsType> newsTypeList=newsTypeDao.newsTypeList(con);
			
			String sql="select * from t_news where isImage=1 order by publishDate desc limit 0,5";
			List<News> imageNewsList=newsDao.newsList(con, sql);
			request.setAttribute("imageNewsList", imageNewsList);
			
			sql="select * from t_news where isHead=1 order by publishDate desc limit 0,1 ";
			List<News> headNewsList=newsDao.newsList(con, sql);
			News headNews=headNewsList.get(0);
			headNews.setContent(StringUtil.Html2Text(headNews.getContent()));
			request.setAttribute("headNews", headNews);
			
			
			sql="select * from t_news where isHot=1 order by publishDate desc limit 0,8 ";
			List<News> hotSpotNewsList=newsDao.newsList(con, sql);
			request.setAttribute("hotSpotNewsList", hotSpotNewsList);
			
			List allIndexNewsList=new ArrayList();
			if(newsTypeList!=null && newsTypeList.size()!=0){
				for(int i=0;i<newsTypeList.size();i++){
					NewsType newsType=newsTypeList.get(i);
					sql="select * from t_news,t_newsType where typeId=newsTypeId and typeId="+newsType.getNewsTypeId()+" order by publishDate desc limit 0,8";
					List<News> oneSubList=newsDao.newsList(con, sql);
					allIndexNewsList.add(oneSubList);
				}
			}
			request.setAttribute("allIndexNewsList", allIndexNewsList);
			
			sql="select * from t_link order by orderNum ";
			List<Link> linkList=linkDao.linkList(con, sql);
			request.setAttribute("linkList", linkList);
			
			request.getRequestDispatcher("index.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}

NewsServlet

package com.java1234.web;

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONObject;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import com.java1234.dao.CommentDao;
import com.java1234.dao.NewsDao;
import com.java1234.dao.NewsTypeDao;
import com.java1234.model.Comment;
import com.java1234.model.News;
import com.java1234.model.NewsType;
import com.java1234.model.PageBean;
import com.java1234.util.DateUtil;
import com.java1234.util.DbUtil;
import com.java1234.util.NavUtil;
import com.java1234.util.PageUtil;
import com.java1234.util.PropertiesUtil;
import com.java1234.util.ResponseUtil;
import com.java1234.util.StringUtil;

public class NewsServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	DbUtil dbUtil=new DbUtil();
	NewsDao newsDao=new NewsDao();
	NewsTypeDao newsTypeDao=new NewsTypeDao();
	CommentDao commentDao=new CommentDao();
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String action=request.getParameter("action");
		if("list".equals(action)){
			this.newsList(request, response);
		}else if("show".equals(action)){
			this.newsShow(request, response);
		}else if("preSave".equals(action)){
			this.newsPreSave(request, response);
		}else if("save".equals(action)){
			this.newsSave(request, response);
		}else if("backList".equals(action)){
			this.newsBackList(request,response);
		}else if("delete".equals(action)){
			this.newsDelete(request,response);
		}
		
	}

	private void newsList(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String typeId=request.getParameter("typeId");
		String page=request.getParameter("page");
		if(StringUtil.isEmpty(page)){
			page="1";
		}
		Connection con=null;
		News s_news=new News();
		if(StringUtil.isNotEmpty(typeId)){
			s_news.setTypeId(Integer.parseInt(typeId));
		}
		try{
			con=dbUtil.getCon();
			int total=newsDao.newsCount(con, s_news,null,null);
			PageBean pageBean=new PageBean(Integer.parseInt(page),Integer.parseInt(PropertiesUtil.getValue("pageSize")));
			List<News> newestNewsListWithType=newsDao.newsList(con, s_news, pageBean,null,null);
			request.setAttribute("newestNewsListWithType", newestNewsListWithType);
			request.setAttribute("navCode", NavUtil.genNewsListNavigation(newsTypeDao.getNewsTypeById(con, typeId).getTypeName(), typeId));
			request.setAttribute("pageCode", PageUtil.getUpAndDownPagation(total, Integer.parseInt(page), Integer.parseInt(PropertiesUtil.getValue("pageSize")), typeId));
			request.setAttribute("mainPage", "news/newsList.jsp");
			request.getRequestDispatcher("foreground/newsTemp.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private void newsShow(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String newsId=request.getParameter("newsId");
		Connection con=null;
		try{
			con=dbUtil.getCon();
			newsDao.newsClick(con, newsId);
			News news=newsDao.getNewsById(con, newsId);
			Comment s_comment=new Comment();
			s_comment.setNewsId(Integer.parseInt(newsId));
			List<Comment> commentList=commentDao.commentList(con, s_comment,null,null,null);
			request.setAttribute("commentList", commentList);
			request.setAttribute("news", news);
			request.setAttribute("pageCode", this.genUpAndDownPageCode(newsDao.getUpAndDownPageId(con, newsId)));
			request.setAttribute("navCode", NavUtil.genNewsNavigation(news.getTypeName(), news.getTypeId()+"",news.getTitle()));
			request.setAttribute("mainPage", "news/newsShow.jsp");
			request.getRequestDispatcher("foreground/newsTemp.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private String genUpAndDownPageCode(List<News> upAndDownPage){
		News upNews=upAndDownPage.get(0);
		News downNews=upAndDownPage.get(1);
		StringBuffer pageCode=new StringBuffer();
		if(upNews.getNewsId()==-1){
			pageCode.append("<p>Previous: none</p>");
		}else{
			pageCode.append("<p>Previous: <a href='news?action=show&newsId="+upNews.getNewsId()+"'>"+upNews.getTitle()+"</a></p>");
		}
		if(downNews.getNewsId()==-1){
			pageCode.append("<p>Next: none</p>");
		}else{
			pageCode.append("<p>Next: <a href='news?action=show&newsId="+downNews.getNewsId()+"'>"+downNews.getTitle()+"</a></p>");
		}
		return pageCode.toString();
	}

	private void newsPreSave(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String newsId=request.getParameter("newsId");
		Connection con=null;
		try{
			con=dbUtil.getCon();
			if(StringUtil.isNotEmpty(newsId)){
				News news=newsDao.getNewsById(con, newsId);
				request.setAttribute("news", news);
			}
			List<NewsType> newsTypeList=newsTypeDao.newsTypeList(con);
			request.setAttribute("newsTypeList", newsTypeList);
			if(StringUtil.isNotEmpty(newsId)){
				request.setAttribute("navCode", NavUtil.genNewsManageNavigation("ÐÂÎŹÜÀí", "ÐÂÎÅÐÞ¸Ä"));				
			}else{
				request.setAttribute("navCode", NavUtil.genNewsManageNavigation("ÐÂÎŹÜÀí", "ÐÂÎÅÌí¼Ó"));				
			}
			request.setAttribute("mainPage", "/background/news/newsSave.jsp");
			request.getRequestDispatcher("/background/mainTemp.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private void newsSave(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		FileItemFactory factory=new DiskFileItemFactory();
		ServletFileUpload upload=new ServletFileUpload(factory);
		List<FileItem> items=null;
		try {
			items=upload.parseRequest(request);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Iterator itr=items.iterator();
		News news=new News();
		while(itr.hasNext()){
			FileItem item=(FileItem) itr.next();
			if(item.isFormField()){
				String fieldName=item.getFieldName();
				if("newsId".equals(fieldName)){
					if(StringUtil.isNotEmpty(item.getString("utf-8"))){
						news.setNewsId(Integer.parseInt(item.getString("utf-8")));
					}
				}
				if("title".equals(fieldName)){
					news.setTitle(item.getString("utf-8"));
				}
				if("content".equals(fieldName)){
					news.setContent(item.getString("utf-8"));
				}
				if("author".equals(fieldName)){
					news.setAuthor(item.getString("utf-8"));
				}
				if("typeId".equals(fieldName)){
					news.setTypeId(Integer.parseInt(item.getString("utf-8")));
				}
				if("isHead".equals(fieldName)){
					news.setIsHead(Integer.parseInt(item.getString("utf-8")));
				}
				if("isImage".equals(fieldName)){
					news.setIsImage(Integer.parseInt(item.getString("utf-8")));
				}
				if("isHot".equals(fieldName)){
					news.setIsHot(Integer.parseInt(item.getString("utf-8")));
				}
				if("imageName".equals(fieldName)&&news.getImageName()==null){
					if(StringUtil.isNotEmpty(item.getString("utf-8"))){
						news.setImageName(item.getString("utf-8").split("/")[1]);
					}
				}
			}else if(!"".equals(item.getName())){
				try {
					String imageName=DateUtil.getCurrentDateStr();
					news.setImageName(imageName+"."+item.getName().split("\\.")[1]);
					String filePath=PropertiesUtil.getValue("imagePath")+imageName+"."+item.getName().split("\\.")[1];
					item.write(new File(filePath));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		
		
		Connection con=null;
		try{
			con=dbUtil.getCon();
			if(news.getNewsId()!=0){
				newsDao.newsUpdate(con, news);
			}else{
				newsDao.newsAdd(con, news);
			}
			request.getRequestDispatcher("/news?action=backList").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private void newsBackList(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String s_bPublishDate=request.getParameter("s_bPublishDate");
		String s_aPublishDate=request.getParameter("s_aPublishDate");
		String s_title=request.getParameter("s_title");
		String page=request.getParameter("page");
		HttpSession session=request.getSession();
		if(StringUtil.isEmpty(page)){
			page="1";
			session.setAttribute("s_bPublishDate", s_bPublishDate);
			session.setAttribute("s_aPublishDate", s_aPublishDate);
			session.setAttribute("s_title", s_title);
		}else{
			s_bPublishDate=(String) session.getAttribute("s_bPublishDate");
			s_aPublishDate=(String) session.getAttribute("s_aPublishDate");
			s_title=(String) session.getAttribute("s_title");
		}
		Connection con=null;
		News s_news=new News();
		if(StringUtil.isNotEmpty(s_title)){
			s_news.setTitle(s_title);
		}
		try{
			con=dbUtil.getCon();
			int total=newsDao.newsCount(con, s_news, s_bPublishDate, s_aPublishDate);
			String pageCode=PageUtil.getPagation(request.getContextPath()+"/news?action=backList", total, Integer.parseInt(page), Integer.parseInt(PropertiesUtil.getValue("backPageSize")));
			PageBean pageBean=new PageBean(Integer.parseInt(page),Integer.parseInt(PropertiesUtil.getValue("backPageSize")));
			List<News> newsBackList=newsDao.newsList(con, s_news,pageBean,s_bPublishDate,s_aPublishDate);
			request.setAttribute("pageCode", pageCode);
			request.setAttribute("newsBackList", newsBackList);
			request.setAttribute("navCode", NavUtil.genNewsManageNavigation("ÐÂÎŹÜÀí", "ÐÂÎÅά»¤"));
			request.setAttribute("mainPage", "/background/news/newsList.jsp");
			request.getRequestDispatcher("/background/mainTemp.jsp").forward(request, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	private void newsDelete(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException{
		String newsId=request.getParameter("newsId");
		Connection con=null;
		boolean delFlag;
		try{
			con=dbUtil.getCon();
			int delNums=newsDao.newsDelete(con, newsId);
			if(delNums==1){
				delFlag=true;
			}else{
				delFlag=false;
			}
			ResponseUtil.write(delFlag, response);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}

如果也想学习本系统,下面领取。关注并回复:128jsp

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/41893.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

HTML5学习笔记(五)

CSS3 多列布局 CSS3新增了一种布局方式——多列布局。使用多列布局&#xff0c;可以轻松实现类似报纸那样的布局。 多列布局的应用非常广泛&#xff0c;像各大电商网站、素材网站中常见的“瀑布流效果”。 column-count属性来定义多列布局的列数。 column-width属性来定义多列…

【云原生系列】第四讲:Knative 之 Eventing

目录 序言 1.基础介绍 2.组成要素 2.1 事件源&#xff08;Event Source&#xff09; 2.2 事件处理&#xff08;Flow&#xff09; 2.3 事件消费者&#xff08;Event Consumer&#xff09; 3.架构模式 3.1 Source to Service ​编辑 3.2Channels & Subscriptions …

思科配置SVI实现VLAN间路由

思科SVI配置 说明 SVI技术与单臂路由和传统VLAN间路由一样&#xff0c;都是解决多个VLAN间通信问题。 SVI技术利用了多层交换机&#xff08;本文以三层交换机为例&#xff09;。 示例拓扑 其中S1为三层交换机 S2的Fa0/2接口于VLAN 10下 S3的Fa0/2接口于VLAN 20下 PC 1地…

NH2-picolyl-azide|2168629-06-7|Amine azide Picolyl叠氮生物标记基团

【产品描述】 西安凯新生物科技有限公司​picolyl-azide-NH2含有叠氮基&#xff0c;叠氮基可以通过点击化学与炔烃、BCN、DBCO反应&#xff0c;生成稳定的三唑键。末端羧酸在活化剂&#xff08;如EDC或HATU&#xff09;存在下可与伯胺基反应&#xff0c;形成稳定的酰胺键。叠氮…

python基础之面向对象基础语法

文章目录一、面向对象基础语法1.dir内置函数&#xff1a;2.定义一个简单的类&#xff08;只包含方法&#xff09;&#xff1a;二、实例演练3.面对对象练习&#xff1a;小明爱跑步需求&#xff1a;4.摆放家具练习&#xff1a;5.士兵突击&#xff0c;需求&#xff1a;6.私有属性和…

CDN技术介绍

引言 随着Internet技术和多媒体技术的不断发展&#xff0c;图像、音频、视频服务所占的比重越来越大&#xff0c;加之网民数量激增&#xff0c;网络访问距离过长&#xff0c;导致网络负载迅速增加&#xff0c;从而使用户的访问质量受到严重影响。传统的缓存技术对交互性强和比…

【ML特征工程】第 9 章 :回到特征:构建学术论文推荐器

&#x1f50e;大家好&#xff0c;我是Sonhhxg_柒&#xff0c;希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流&#x1f50e; &#x1f4dd;个人主页&#xff0d;Sonhhxg_柒的博客_CSDN博客 &#x1f4c3; &#x1f381;欢迎各位→点赞…

算法leetcode|17. 电话号码的字母组合(rust重拳出击)

文章目录17. 电话号码的字母组合&#xff1a;样例 1&#xff1a;样例 2&#xff1a;样例 3&#xff1a;提示&#xff1a;原题传送门&#xff1a;分析题解rustgocjavatypescriptpython17. 电话号码的字母组合&#xff1a; 给定一个仅包含数字 2-9 的字符串&#xff0c;返回所有…

向NS-3添加新模块_ns3.35添加新模块_ns3.35以及更早版本添加新模块

2022年11月&#xff0c;ns3官网发布了3.37版本&#xff0c;与3.36一样&#xff0c;运行、编译、配置的时候使用的都是ns3.37/ns3 这个脚本&#xff0c;但3.35以及3.35以前的版本使用的都是ns3.35/waf脚本&#xff0c;相应的3.35以及以前的版本与3.36以后的版本&#xff0c;新生…

Java迭代器 for循环的区别

1、Iterator接口&#xff1a; Iterator接口包含三个方法&#xff1a;hasNext&#xff0c;next&#xff0c;remove Iterator常用于对集合进行 一边遍历一边修改 的操作 注意&#xff1a;当Iterator迭代访问Collection集合中元素时&#xff0c;Collection的元素不能改变&#x…

数据库实践 Hw02

Assignment 02: get familiar with operations in MySQL 创建数据库 创建名字为bank的银行数据库 create database if not exists bank; show create database bank; use bank; show tables;可以获得如下内容 后续展示bank数据库中的tables tables为空 bank数据中创建表…

【Compose】Desktop Application 初尝试

前言 作为一个多年的android开发者&#xff0c;自从Jetpack发布以来&#xff0c;其中的Compose组件就深深的吸引了我&#xff0c;在去年就用新版android studio创建模板尝鲜了一把&#xff0c;不过并没有投入太多时间和精力&#xff0c;其实还有一个消息我没太关注&#xff0c…

算法提升:图的最小生成树算法-克鲁斯卡尔(Kruskal)

目录 概念 思路 代码 概念 克鲁斯卡尔算法查找最小生成树的方法是&#xff1a;将连通网中所有的边按照权值大小做升序排序&#xff0c;从权值最小的边开始选择&#xff0c;只要此边不和已选择的边一起构成环路&#xff0c;就可以选择它组成最小生成树。对于 N 个顶点的连通网…

axios数据交互

目录 一、axios 概念 二、官方文档 三、下载命令 四、特点 五、基本语法 六、基本案例 一、axios 概念 axios 是基于promise创建的http库&#xff0c;可以用于客户端&#xff08;浏览器&#xff09;和 node.js ​ 官方概念&#xff1a; Axios 是一个基于 promise 的 HTT…

面向OLAP的列式存储DBMS-13-[ClickHouse]的MergeTree表引擎原理解析

ClickHouse 中最重要的表引擎&#xff1a;MergeTree 的深度原理解析 首先我们了解了 MergeTree 的基础属性和物理存储结构&#xff1b;接着&#xff0c;依次介绍了数据分区、一级索引、二级索引、数据存储和数据标记的重要特性&#xff1b;最后总结了 MergeTree 上述特性一起协…

C++ Reference: Standard C++ Library reference: C Library: cwctype: iswdigit

C官网参考链接&#xff1a;https://cplusplus.com/reference/cwctype/iswdigit/ 函数 <cwctype> iswdigit int iswdigit (wint_t c); 检查宽字符是否为十进制数字 检查c是否为十进制数字字符。 十进制数字是0 1 2 3 4 5 6 7 8 9中的任意一个。 此函数是isdigit&#xff…

【Web前端基础进阶学习】HTML详解(下篇)

上篇学习到了HTML列表&#xff0c;现在从区块开始学习&#xff01; 一起学习下篇吧! 一.HTML区块 1.HTML区块元素2.HTML内联元素3.HTML的 div 元素4.HTML的 span 元素 二.HTML布局 1.使用div元素添加网页布局2.使用table元素添加网页布局 三.HTML表单和输入 1.文本域2.密码字…

压缩包密码可以删除吗?

压缩包文件设置了密码&#xff0c;但是长时间没有使用&#xff0c;忘记了密码、不能解压压缩包了&#xff0c;还能够删除压缩包密码嘛&#xff1f; 压缩包设置的加密&#xff0c;不需要再加密了&#xff0c;可以删除压缩包密码&#xff0c;以后不需要输入密码再解压密码了&…

11_html

知识点1【HTML概述】 知识点2【文字标签】 知识点3【标题】 知识点4【超链接】 知识点5【table表格标签】&#xff08;重要&#xff09; 知识点6【form表单】&#xff08;重要&#xff09; 知识点7【JavaScript的概述】让网页动起来 1、什么是 Javascript? 2、网页使用j…

【LEACH协议】无线传感器网络LEACH与DEEC协议【含Matlab源码 2187期】

⛄一、 简介 1 引言 WSN 由能感知外部环境的传感器节点以自组网的形式构成&#xff0c;是一种分布式无线传感器网络。随着科技的进步和现代生活的需求&#xff0c;由于 WSN 的远程控制、信息即时传播以及低功耗等众多优点&#xff0c;WSN 在军事医疗、生活娱乐和工业生产等各个…