基于struts2,hibernate的小javaweb项目

19:47:49

这是截图

闲话不说 就开始了

web-xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><!-- structs2的配置 --><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>
</web-app>

 struts-xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><package name="default" extends="struts-default"><!-- 用于页面重转 --><action name="turnaddMessage" class="sedion.xq.action.turnAction"><result name="success">/WEB-INF/student/addMessage.jsp</result></action><action name="turndeleteMessage" class="sedion.xq.action.turnAction"method="getid"><result name="success">/WEB-INF/student/deleteMessage.jsp</result></action><action name="turnfindMessage" class="sedion.xq.action.turnAction"method="getid"><result name="success">/WEB-INF/student/findMessage.jsp</result></action><!-- look stu message --><action name="lookMessageAction" class="sedion.xq.action.lookMessageAction"><result name="success">/WEB-INF/student/lookMessage.jsp</result><result name="input">/index.jsp</result></action><!-- delet stu message --><action name="deleteMessageAction" class="sedion.xq.action.deleteMessageAction"><result name="success" type="chain">lookMessageAction</result><result name="input">/student/deleteMessage.jsp</result></action><!-- add stu message --><action name="addMessageActon" class="sedion.xq.action.addMessageAction"><result name="success" type="chain">lookMessageAction</result><result name="input">/student/deleteMessage.jsp</result></action><!-- find stu message --><action name="findMessageAction" class="sedion.xq.action.findMessageAction"><result name="success">/WEB-INF/student/updateMessage.jsp</result><result name="input">/student/findMessage.jsp</result></action><!-- update stu message --><action name="updateMessageActon" class="sedion.xq.action.updateMessageAction"><result name="success" type="chain">lookMessageAction</result><result name="input">/WEB-INF/student/updateMessage.jsp</result></action></package></struts>

 hibernate.cfg.xml:(申明 这里用的是SQL service 2005   若修改 这里修改 链接数据库    该数据库  名字LQQ  里面一张表格   在最后会发布)

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.  -->
<hibernate-configuration><session-factory><property name="connection.username">sa</property><property name="connection.url">jdbc:jtds:sqlserver://localhost:1433;DatabaseName=LQQ</property><property name="dialect">org.hibernate.dialect.SQLServerDialect</property><!--<property name="myeclipse.connection.profile">LoginSystem</property>  --><property name="connection.password">sa</property><property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property><property name="show_sql">true</property><!-- POJO 类映射配置--><mapping resource="sedion/xq/ORM/Stuinfo.hbm.xml" /></session-factory>
</hibernate-configuration>

 然后 贴出  HibernateSessionFactory.java:

package sedion.xq.hibernate;import javax.swing.JOptionPane;import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;public class HibernateSessionFactory {private static SessionFactory sessionFactory;private static Configuration configuration = new Configuration();public HibernateSessionFactory() {}static {try {Configuration configure = configuration.configure("hibernate.cfg.xml");System.out.println(configure);sessionFactory = configure.buildSessionFactory();} catch (Exception e) {// TODO: handle exceptionSystem.out.println("HibernateSessionFactory  wrong!!");message("生成SessionFactory失败"+e);}}public static Session getSession() {System.out.println(sessionFactory.openSession());return sessionFactory.openSession();}public static void message(String mess){int type=JOptionPane.YES_NO_CANCEL_OPTION;String title="提示消息";JOptionPane.showMessageDialog(null,mess,title, type);}
}

 

然后 再贴出  ORM:

Stuinfo.java:

package sedion.xq.ORM;public class Stuinfo {private String id;private String name;private String sex;private int age;private float weight;public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public float getWeight() {return weight;}public void setWeight(float weight) {this.weight = weight;}}

 该类的映射文件如下:

Stuinfo.hbm.xml(自然可以根据这个表格  还原数据库的表格  表名:stuinfo):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0
//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping><class name="sedion.xq.ORM.Stuinfo" table="stuinfo"><id name="id" type="string"><column name="id" length="20" /><generator class="assigned" /></id><property name="name" type="string" length="20" /><property name="sex" type="string" length="5" /><property name="age" type="integer" /><property name="weight" type="float" /></class>
</hibernate-mapping>

 

然后 再贴出  DAO层:

StudentDao.java:

package sedion.xq.DAO;import java.util.List;import javax.swing.JOptionPane;import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;import sedion.xq.ORM.Stuinfo;
import sedion.xq.hibernate.HibernateSessionFactory;
import sun.swing.UIAction;public class StudentDao {private Transaction transaction;private Session session;private Query query;public StudentDao() {}// 显示public List findAllInfo() {session = HibernateSessionFactory.getSession();try {transaction = session.beginTransaction();String querysString = "from Stuinfo";query = session.createQuery(querysString);List<Stuinfo> list = query.list();System.out.println(list);transaction.commit();session.close();return list;} catch (Exception e) {message("findInfo.error" + e);e.printStackTrace();return null;}}// save messagepublic boolean saveInfo(Stuinfo info) {try {session = HibernateSessionFactory.getSession();transaction = session.beginTransaction();session.save(info);transaction.commit();session.close();return true;} catch (Exception e) {message("saveInfo.error" + e);e.printStackTrace();return false;}}public boolean deleteInfo(String id) {try {session = HibernateSessionFactory.getSession();transaction = session.beginTransaction();Stuinfo info = new Stuinfo();info = (Stuinfo) session.get(Stuinfo.class, id);session.delete(info);transaction.commit();session.close();return true;} catch (Exception e) {message("deleteInfo.error" + e);e.printStackTrace();return false;}}public List<Stuinfo> findInfo(String id) {try {session = HibernateSessionFactory.getSession();transaction = session.beginTransaction();query = session.createQuery("from Stuinfo stu where stu.id like?");query.setString(0, id);List<Stuinfo> list = query.list();System.out.println(list);transaction.commit();session.close();return list;} catch (Exception e) {message("deleteInfo.error" + e);e.printStackTrace();return null;}}public boolean updateInfo(Stuinfo info,String id) {try {System.out.println(id+"didiididid");session = HibernateSessionFactory.getSession();transaction = session.beginTransaction();query = session.createQuery("delete from Stuinfo stu where stu.id like?");query.setString(0, id);query.executeUpdate();session.saveOrUpdate(info);transaction.commit();session.close();return true;} catch (Exception e) {message("updateInfo.error" + e);e.printStackTrace();return false;}}private void message(String mess) {int type = JOptionPane.YES_NO_CANCEL_OPTION;String title = "提示消息";JOptionPane.showMessageDialog(null, mess, title, type);}}

 下面是6个 jsp:

index.JSP:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息管理</title></head><body><div align="center"><font size=6>学生信息管理系统Struts2+ Hibernate</font><hr color="red"/><font > ------made by sedion.xq</font><br /><s:a href="lookMessageAction.action">点击进入</s:a></div></body>
</html>

 

lookMessage.jsp:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息统一查询</title></head><body bgcolor="#7EC0EE"><s:div align="center"><hr color="red" /><br /><table align="center" width="80%"><tr><td width="25%">查看学生信息</td><td width="25%"><s:a href="turnaddMessage.action">添加学生信息</s:a></td><td width="25%"><s:a href="turnfindMessage.action">修改学生信息</s:a></td><td width="25%"><s:a href="turndeleteMessage.action">删除学生信息</s:a></td></tr></table><br /><hr color="red" /><br /><br /><br /><span>你要查询的数据表的人数共有 <%=request.getSession().getAttribute("count")%>人</span></s:div><table align="center" width="80%" border="2" bordercolor="blue"><tr><th>记录条数</th><th>学号</th><th>姓名</th><th>性别</th><th>年龄</th><th>体重</th></tr><s:iterator id="lsit" value="list" status="st"><tr><td align="center"><s:property value="#st.count" /></td><td>${id}</td><td>${name}</td><td>${sex}</td><td>${age}</td><td>${weight}</td></tr></s:iterator></table></body>
</html>

 updateMessage.jsp:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息--修改信息</title></head><body bgcolor="#7EC0EE"><s:div align="center"><hr color="red" /><br /><table align="center" width="80%"><tr><td width="25%"><s:a href="lookMessageAction.action">查看学生信息</s:a></td><td width="25%"><s:a href="turnaddMessage.action">添加学生信息</s:a></td><td width="25%"><s:a>修改学生信息</s:a></td><td width="25%"><s:a href="turndeleteMessage.action">删除学生信息</s:a></td></tr></table><br /><hr color="red" /><br /><br /><br /><center><font color="black" size="6">修改学生信息</font></center></s:div><s:form action="updateMessageActon" method="post"><table align="center" width="30%" border="2"><s:iterator value="list" id="list"><tr><td><s:textfield readonly="true" name="id" label="学号" maxLength="16" value="%{id}"></s:textfield></td><td><s:textfield name="name" label="姓名" value="%{name}"></s:textfield></td><td><s:select name="sex" label="性别" list="{'男','女'}" value="%{sex}" /></td><td><s:textfield name="age" label="年龄" value="%{age}"></s:textfield></td><td><s:textfield name="weight" label="体重" value="%{weight}"></s:textfield></td><td colspan="2"><s:submit value="提交" align="center"></s:submit><s:reset value="清除" align="center"></s:reset></td></tr></s:iterator></table></s:form><br></body>
</html>

 findMessage.jsp:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息管理系统-查找</title></head><body bgcolor="#7EC0EE"><s:div align="center"><hr color="red" /><br /><table align="center" width="80%"><tr><td width="25%"><a href="lookMessageAction.action">查看学生信息</a></td><td width="25%"><s:a href="turnaddMessage.action">添加学生信息</s:a></td><td width="25%"><s:a>修改学生信息</s:a></td><td width="25%"><s:a href="turndeleteMessage.action">删除学生信息</s:a></td></tr></table><br /><hr color="red" /><br /><br /><br /><font size="5">修改学生信息</font></s:div><s:form action="findMessageAction" method="post"><table align="center" width="40%" border="2" bordercolor="blue"><tr><td width="40%"><s:select name="id" label="请选择要修改的学生的学号:" list="list.{id}"></s:select></td><td><s:submit value="确定" align="center"></s:submit></td></tr></table></s:form></body>
</html>

 deleteMessage.jsp:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息--删除</title></head><body><body bgcolor="#7EC0EE"><s:div align="center"><hr color="red" /><br /><table align="center" width="80%"><tr><td width="25%"><s:a href="lookMessageAction.action">查看学生信息</s:a></td><td width="25%"><s:a href="turnaddMessage.action">添加学生信息</s:a></td><td width="25%"><s:a href="turnfindMessage.action">修改学生信息</s:a></td><td width="25%"><s:a>删除学生信息</s:a></td></tr></table><br /><hr color="red" /><br /><br /><br /><font size="5">删除学生信息</font></s:div><s:form action="deleteMessageAction" method="post"><table align="center" width="40%" border="2" bordercolor="blue"><tr><td width="40%"><s:select name="id" label="请选择要删除的学生的学号:" list="list.{id}"></s:select></td><td ><s:submit value="确定" align="center"></s:submit></td></tr></table></s:form></body>
</html>

 addMessage.jsp:

<%@	page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>学生信息--添加信息</title></head><body bgcolor="#7EC0EE"><s:div cssClass="align"><hr color="red" /><br /><table align="center" width="80%"><tr><td width="25%"><s:a href="lookMessageAction.action">查看学生信息</s:a></td><td width="25%">添加学生信息</td><td width="25%"><s:a href="turnfindMessage.action">修改学生信息</s:a></td><td width="25%"><s:a href="turndeleteMessage.action">删除学生信息</s:a></td></tr></table><br /><hr color="red" /><br /><br /><br /><center><font color="black" size="6">添加学生信息</font></center></s:div><s:form action="addMessageActon" method="post"><table align="center" width="30%"  border="2"><tr><td><s:textfield name="id" label="学号" maxLength="16"></s:textfield></td><td><s:textfield name="name" label="姓名" ></s:textfield></td><td><s:select name="sex" label="性别" list="{'男','女'}"/></td><td><s:textfield name="age" label="年龄"></s:textfield></td><td><s:textfield name="weight" label="体重" ></s:textfield></td><td colspan="2" ><s:submit value="提交" align="center"></s:submit><s:reset value="清除" align="center"></s:reset></td></tr></table></s:form></body>
</html>

 下面是6个action包里面的处理:

turnAction.java:

 

package sedion.xq.action;import java.util.ArrayList;
import java.util.List;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.ActionSupport;import sedion.xq.DAO.StudentDao;
import sedion.xq.ORM.Stuinfo;public class turnAction extends ActionSupport {private List<Stuinfo> list = new ArrayList<Stuinfo>();public List<Stuinfo> getList() {return list;}public void setList(List<Stuinfo> list) {this.list = list;}public String execute() throws Exception {return "success";}public String getid() throws Exception {StudentDao dao = new StudentDao();list = dao.findAllInfo();return "success";}
}

 lookMessageAction.java:

package sedion.xq.action;import java.util.ArrayList;
import java.util.List;import javax.servlet.http.HttpServletRequest;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.ActionSupport;
import com.sun.org.apache.bcel.internal.generic.NEW;import sedion.xq.DAO.StudentDao;
import sedion.xq.ORM.Stuinfo;public class lookMessageAction extends ActionSupport{private HttpServletRequest request;private String message = "input";private List<Stuinfo> list=new ArrayList<Stuinfo>();public List<Stuinfo> getList() {return list;}public void setList(List<Stuinfo> list) {this.list = list;}@SuppressWarnings("unchecked")public String execute() throws Exception {try {		request = ServletActionContext.getRequest();StudentDao dao = new StudentDao();list = dao.findAllInfo();request.getSession().setAttribute("count", list.size());request.getSession().setAttribute("allInfo", list);message = "success";} catch (Exception e) {e.printStackTrace();}return message;}
}

 updateMessageAction:

package sedion.xq.action;import javax.swing.JOptionPane;import sedion.xq.DAO.StudentDao;
import sedion.xq.ORM.Stuinfo;import com.opensymphony.xwork2.ActionSupport;public class updateMessageAction extends ActionSupport {private String id;private String name;private String sex;private int age;private float weight;private String message = "input";public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public float getWeight() {return weight;}public void setWeight(float weight) {this.weight = weight;}private Stuinfo Info() {Stuinfo info = new Stuinfo();info.setId(this.getId());info.setName(this.getName());info.setSex(this.getSex());info.setAge(this.getAge());info.setWeight(this.getWeight());return info;}public String execute() throws Exception {StudentDao dao = new StudentDao();boolean update = dao.updateInfo(Info(),this.getId());if (update) {message = "success";}return message;}private void message(String mess) {int type = JOptionPane.YES_NO_CANCEL_OPTION;String title = "提示消息";JOptionPane.showMessageDialog(null, mess, title, type);}
}

 findMessageAction.java:

package sedion.xq.action;import java.util.ArrayList;
import java.util.List;import sedion.xq.DAO.StudentDao;
import sedion.xq.ORM.Stuinfo;import com.opensymphony.xwork2.ActionSupport;public class findMessageAction extends ActionSupport {private String id;private String message;private List<Stuinfo> list = new ArrayList<Stuinfo>();public List<Stuinfo> getList() {return list;}public void setList(List<Stuinfo> list) {this.list = list;}public String getId() {return id;}public void setId(String id) {this.id = id;}public String execute() throws Exception {try {StudentDao dao = new StudentDao();list = dao.findInfo(this.getId());message = "success";} catch (Exception e) {e.printStackTrace();}return message;}}

 deleteMessageAction.java:

package sedion.xq.action;import org.apache.struts2.ServletActionContext;import sedion.xq.DAO.StudentDao;public class deleteMessageAction {private String id;private String message;public String getId() {return id;}public void setId(String id) {this.id = id;}public String execute() throws Exception {try {StudentDao dao = new StudentDao();boolean del=dao.deleteInfo(this.getId());if (del) {message = "success";}} catch (Exception e) {e.printStackTrace();}return message;}
}

 addMessageAction.java:

package sedion.xq.action;import java.util.List;import javax.swing.JOptionPane;import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.finder.ClassFinder.Info;import sedion.xq.DAO.StudentDao;
import sedion.xq.ORM.Stuinfo;public class addMessageAction extends ActionSupport{/*** */private static final long serialVersionUID = 1L;private String id;private String name;private String sex;private int age;private float weight;private String message = "input";public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public float getWeight() {return weight;}public void setWeight(float weight) {this.weight = weight;}public String execute() throws Exception {StudentDao dao = new StudentDao();boolean save = dao.saveInfo(Info());if (save) {message = "success";}return message;}private Stuinfo Info() {Stuinfo info = new Stuinfo();info.setId(this.getId());info.setName(this.getName());info.setSex(this.getSex());info.setAge(this.getAge());info.setWeight(this.getWeight());return info;}private void message(String mess) {int type = JOptionPane.YES_NO_CANCEL_OPTION;String title = "提示消息";JOptionPane.showMessageDialog(null, mess, title, type);}
}

 终于到最后了  , 下面发下  表格的截图

  

 

 谢谢  java大师我的偶像   一步一步接近

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

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

相关文章

MySql的用户权限

用户管理 MySQL数据库中的表与其他任何关系表没有区别&#xff0c;都可以通过典型的SQL命令修改其结构和数据。可以使用GRANT和REVOKE命令。通过这些命令&#xff0c;可以创建和禁用用户&#xff0c;可以在线授予和撤回用户访问权限。在5.0版本中增加了两个新命令&#xff1a;C…

.yaml 文件格式简介

From: https://www.cnblogs.com/wxmdevelop/p/7341292.html YAML 的意思其实是&#xff1a;"Yet Another Markup Language"&#xff08;仍是一种置标语言&#xff09;的缩写。 功能 YAML的语法和其他高阶语言类似&#xff0c;并且可以简单表达清单、散列表&#x…

SnakeYaml快速入门

From: https://www.jianshu.com/p/d8136c913e52 在YAML快速入门[https://www.jianshu.com/p/97222440cd08]中&#xff0c;我们已经简单介绍了YAML的语法&#xff0c;本节中主要介绍YAML的配置读取。 目前有很多可以生成和解析YAML的第三方工具&#xff0c;常见的&#xff0c;…

有源代码的iphone项目

2019独角兽企业重金招聘Python工程师标准>>> http://blog.joomla.org.tw/iphone-ipad/104-iphone.html 學習和利用現成的資源是很重要的&#xff0c;以下列出有原始碼可下載的iPhone/iPod程式&#xff0c;這邊收集的是以已經放到App Store上的程式為主&#xff0c;…

Content Security Policy 入门教程

From: http://www.ruanyifeng.com/blog/2016/09/csp.html 跨域脚本攻击 XSS 是最常见、危害最大的网页安全漏洞。 为了防止它们&#xff0c;要采取很多编程措施&#xff0c;非常麻烦。很多人提出&#xff0c;能不能根本上解决问题&#xff0c;浏览器自动禁止外部注入恶意脚本&…

springboot跨域配置

From: https://www.cnblogs.com/nananana/p/8492185.html 前言&#xff1a; 当它请求的一个资源是从一个与它本身提供的第一个资源的不同的域名时&#xff0c;一个资源会发起一个跨域HTTP请求(Cross-site HTTP request)。 比如说&#xff0c;域名A ( http://domaina.example …

l2正则化

在机器学习中&#xff0c;无论是分类还是回归&#xff0c;都可能存在由于特征过多而导致的过拟合问题。当然解决的办法有 &#xff08;1&#xff09;减少特征&#xff0c;留取最重要的特征。 &#xff08;2&#xff09;惩罚不重要的特征的权重。 但是通常情况下&#xff0c;我们…

机房收费系统的合作版

概述 机房收费系统的合作版自己负责的是B层和Facade层&#xff0c;在做这块的时候有很多的感触&#xff1a;动态SQL语句&#xff1b;设计模式&#xff1b;合作开发应该注意的点。其中动态SQL语句的理解已经在上一篇博客中写了&#xff0c;如果你有意向的话&#xff0c;可以看一…

ajax跨域,这应该是最全的解决方案了

From: https://segmentfault.com/a/1190000012469713 前言 从刚接触前端开发起&#xff0c;跨域这个词就一直以很高的频率在身边重复出现&#xff0c;一直到现在&#xff0c;已经调试过N个跨域相关的问题了&#xff0c;16年时也整理过一篇相关文章&#xff0c;但是感觉还是差…

如何导入ShareSDK的sample

由于项目需要&#xff0c;最近需要做10几个平台的分享&#xff0c;如果自己去集成&#xff0c;浪费很多时间&#xff0c;而且还很难成功。最后发现Sharesdk,可以满足项目需求。 首先&#xff0c;需要到他们的官网http://sharesdk.cn/下载android版本的SDK。 然后玩了一下他们的…

EF5.x Code First 一对多关联条件查询,Contains,Any,All

背景 通过多个部门id获取所有用户&#xff0c;部门和用户是多对多。 已知部门id&#xff0c;获取该部门包括该部门下的所有子部门的所有用户。 关系如下&#xff1a; public class Entity:IEntity{public Guid Id { get; set; }public string CreateUser { get; set; }public D…

Spring5:@Autowired注解、@Resource注解和@Service注解

From: https://www.cnblogs.com/szlbm/p/5512931.html 什么是注解 传统的Spring做法是使用.xml文件来对bean进行注入或者是配置aop、事物&#xff0c;这么做有两个缺点&#xff1a; 1、如果所有的内容都配置在.xml文件中&#xff0c;那么.xml文件将会十分庞大&#xff1b;如…

CCNA实验(8) -- PPP HDLC

HDLC帧格式与以太帧格式有很大差别&#xff0c;HDLC帧没有源MAC和目的MAC地址。HDLC不能提供验证&#xff0c;缺少对链路保护。Cisco设备与Cisco设备连接&#xff0c;可用HDLC封装。Cisco设备与非Cisco设备连接&#xff0c;应使用PPP协议。PPP经过4个过程在点到点链路上建立连接…

不使用中间变量交换2个数据

2019独角兽企业重金招聘Python工程师标准>>> 第一种方法&#xff1a; <!-- lang: cpp -->aab;ba-b;aa-b;可能产生越界和溢出。 第二种方法&#xff1a; <!-- lang: cpp -->aa^b;ba^b;aa^b;这种方法只适用整形数。 写成宏的形式 <!-- lang: cpp -->…

slf4j的简单用法以及与log4j的区别

From: https://www.cnblogs.com/qlqwjy/p/9275415.html 之前在项目中用的日志记录器都是log4j的日志记录器&#xff0c;可是到了新公司发现都是slf4j&#xff0c;于是想着研究一下slf4j的用法。 注意:每次引入Logger的时候注意引入的jar包&#xff0c;因为有Logger的包太多了。…

JdbcType类型和Java类型的对应关系

From: https://www.cnblogs.com/tongxuping/p/7134113.html 在Oracle中有些字段不是必填时在用户使用的时候会出现数据null的情况。这个时候在Oracle中是无法进行插入的。 1 JDBC Type Java Type 2 CHAR String 3 VARCHAR String 4 L…

MyBatis Generator配置文件翻译

From: https://www.cnblogs.com/GaiDynasty/p/4088531.html <classPathEntry> 驱动文件指定配置项 <classPathEntry location"/Program Files/IBM/SQLLIB/java/db2java.zip" /> <columnOverride> 将数据库中的字段重命名为实体类的属性 colu…

SpringBoot系列十:SpringBoot整合Redis

From: https://www.cnblogs.com/leeSmall/p/8728231.html 声明&#xff1a;本文来源于MLDN培训视频的课堂笔记&#xff0c;写在这里只是为了方便查阅。 1、概念&#xff1a;SpringBoot 整合 Redis 2、背景 Redis 的数据库的整合在 java 里面提供的官方工具包&#xff1a;j…

海贼王革命家—龙—实力到底如何?

龙——整个海贼王世界中最神秘的人物&#xff0c;令世界政府最担心的存在&#xff0c;是所有迷最为期待的实力展现&#xff0c;他的身上好像有着无数的秘密等着尾田为我们揭晓。 路飞的父亲——未来的海贼王、卡普的儿子——海军英雄、革民军首领——唯一可以跟世界政府抗衡的组…

MyBatis 实践

From&#xff1a; https://www.cnblogs.com/luyiba/p/6303717.html MyBatis简介 MyBatis前身是iBatis,是一个基于Java的数据持久层/对象关系映射(ORM)框架. MyBatis是对JDBC的封装,使开发人员只需关注SQL本身,而不需花费过多的精力去处理如注册驱动、设置参数、创建Connectio…