hibernate多对多形式(User类<---->Educate类)

1.基于注解的形式:

User类:

  1. package com.ssh.entities;
  2.  
  3. import java.util.Date;
  4. import java.util.HashSet;
  5. import java.util.Set;
  6.  
  7. import javax.persistence.CascadeType;
  8. import javax.persistence.Column;
  9. import javax.persistence.Entity;
  10. import javax.persistence.FetchType;
  11. import javax.persistence.GeneratedValue;
  12. import javax.persistence.Id;
  13. import javax.persistence.JoinColumn;
  14. import javax.persistence.JoinTable;
  15. import javax.persistence.ManyToMany;
  16. import javax.persistence.Table;
  17.  
  18. @Entity
  19. @Table(name="user")
  20. public class User {
  21. @Id
  22. @Column(name="id")
  23. @GeneratedValue
  24. private Long id;//员工编号
  25.  
  26. @Column(name="name")
  27. private String name;//员工用户名
  28.  
  29. @Column(name="password")
  30. private String password;//登录密码
  31.  
  32. @Column(name="sex")
  33. private Byte sex;//性别
  34.  
  35. @Column(name="birthday")
  36. private Date birthday;//生日
  37.  
  38. @Column(name="createtime")
  39. private Date createtime;//创建时间
  40.  
  41. @Column(name="isadmin")
  42. private Byte isadmin;//是否为管理员
  43.  
  44. @Column(name="content")
  45. private String content;//人员简介
  46.  
  47. @ManyToMany(targetEntity=com.ssh.entities.Educate.class,cascade=CascadeType.ALL,
  48. fetch=FetchType.EAGER)
  49. @JoinTable(
  50. name="user_educate",
  51. joinColumns={@JoinColumn(name="user_id")},
  52. inverseJoinColumns={@JoinColumn(name="educate_id")}
  53. )
  54. private Set<Educate> educate=new HashSet<Educate>();
  55. public Set<Educate> getEducate() {
  56. return educate;
  57. }
  58. public void setEducate(Set<Educate> educate) {
  59. this.educate = educate;
  60. }
  61. public Long getId() {
  62. return id;
  63. }
  64. public void setId(Long id) {
  65. this.id = id;
  66. }
  67. public String getName() {
  68. return name;
  69. }
  70. public void setName(String name) {
  71. this.name = name;
  72. }
  73. public String getPassword() {
  74. return password;
  75. }
  76. public void setPassword(String password) {
  77. this.password = password;
  78. }
  79. public Byte getSex() {
  80. return sex;
  81. }
  82. public void setSex(Byte sex) {
  83. this.sex = sex;
  84. }
  85. public Date getBirthday() {
  86. return birthday;
  87. }
  88. public void setBirthday(Date birthday) {
  89. this.birthday = birthday;
  90. }
  91. public Date getCreatetime() {
  92. return createtime;
  93. }
  94. public void setCreatetime(Date createtime) {
  95. this.createtime = createtime;
  96. }
  97. public Byte getIsadmin() {
  98. return isadmin;
  99. }
  100. public void setIsadmin(Byte isadmin) {
  101. this.isadmin = isadmin;
  102. }
  103. public String getContent() {
  104. return content;
  105. }
  106. public void setContent(String content) {
  107. this.content = content;
  108. }
  109. public User(Long id, String name, String password, Byte sex, Date birthday,
  110. Date createtime, Byte isadmin, String content) {
  111. this.id = id;
  112. this.name = name;
  113. this.password = password;
  114. this.sex = sex;
  115. this.birthday = birthday;
  116. this.createtime = createtime;
  117. this.isadmin = isadmin;
  118. this.content = content;
  119. }
  120. public User() {
  121. }
  122. @Override
  123. public String toString() {
  124. return "User [id=" + id + ", name=" + name + ", password=" + password
  125. + ", sex=" + sex + ", birthday=" + birthday + ", createtime="
  126. + createtime + ", isadmin=" + isadmin + ", content=" + content
  127. + "]";
  128. }
  129. @Override
  130. public int hashCode() {
  131. final int prime = 31;
  132. int result = 1;
  133. result = prime * result + ((id == null) ? 0 : id.hashCode());
  134. return result;
  135. }
  136. @Override
  137. public boolean equals(Object obj) {
  138. if (this == obj)
  139. return true;
  140. if (obj == null)
  141. return false;
  142. if (getClass() != obj.getClass())
  143. return false;
  144. User other = (User) obj;
  145. if (id == null) {
  146. if (other.id != null)
  147. return false;
  148. } else if (!id.equals(other.id))
  149. return false;
  150. return true;
  151. }
  152.  
  153. }

Educate类:

  1. package com.ssh.entities;
  2.  
  3. import java.util.Date;
  4. import java.util.HashSet;
  5. import java.util.Set;
  6.  
  7. import javax.persistence.CascadeType;
  8. import javax.persistence.Column;
  9. import javax.persistence.Entity;
  10. import javax.persistence.FetchType;
  11. import javax.persistence.GeneratedValue;
  12. import javax.persistence.GenerationType;
  13. import javax.persistence.Id;
  14. import javax.persistence.ManyToMany;
  15. import javax.persistence.Table;
  16.  
  17. @Entity
  18. @Table(name="educate")
  19. public class Educate {
  20. @Id
  21. @Column(name="id")
  22. @GeneratedValue(strategy=GenerationType.AUTO)
  23. private Long id;//培训标号
  24.  
  25. @Column(name="name")
  26. private String name;//培训名称
  27.  
  28. @Column(name="purpose")
  29. private String purpose;//培训目的
  30.  
  31. @Column(name="begintime")
  32. private Date begintime;//培训开始时间
  33.  
  34. @Column(name="endtime")
  35. private Date endtime;//培训结束时间
  36.  
  37. @Column(name="datum")
  38. private String datum;//培训材料
  39.  
  40. @Column(name="teacher")
  41. private String teacher;//培训讲师
  42.  
  43. @Column(name="student")
  44. private String student;//培训人员
  45.  
  46. @Column(name="createtime")
  47. private Date createtime;//创建时间
  48.  
  49. @Column(name="educate")
  50. private Byte educate;//培训是否完成
  51.  
  52. @Column(name="effect")
  53. private String effect;//培训效果
  54.  
  55. @Column(name="summarize")
  56. private String summarize;//培训总结
  57.  
  58. @ManyToMany(mappedBy="educate",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
  59. private Set<User> user=new HashSet<User>();
  60.  
  61. public Set<User> getUser() {
  62. return user;
  63. }
  64. public void setUser(Set<User> user) {
  65. this.user = user;
  66. }
  67. public Long getId() {
  68. return id;
  69. }
  70. public void setId(Long id) {
  71. this.id = id;
  72. }
  73. public String getName() {
  74. return name;
  75. }
  76. public void setName(String name) {
  77. this.name = name;
  78. }
  79. public String getPurpose() {
  80. return purpose;
  81. }
  82. public void setPurpose(String purpose) {
  83. this.purpose = purpose;
  84. }
  85. public Date getBegintime() {
  86. return begintime;
  87. }
  88. public void setBegintime(Date begintime) {
  89. this.begintime = begintime;
  90. }
  91. public Date getEndtime() {
  92. return endtime;
  93. }
  94. public void setEndtime(Date endtime) {
  95. this.endtime = endtime;
  96. }
  97. public String getDatum() {
  98. return datum;
  99. }
  100. public void setDatum(String datum) {
  101. this.datum = datum;
  102. }
  103. public String getTeacher() {
  104. return teacher;
  105. }
  106. public void setTeacher(String teacher) {
  107. this.teacher = teacher;
  108. }
  109. public String getStudent() {
  110. return student;
  111. }
  112. public void setStudent(String student) {
  113. this.student = student;
  114. }
  115. public Date getCreatetime() {
  116. return createtime;
  117. }
  118. public void setCreatetime(Date createtime) {
  119. this.createtime = createtime;
  120. }
  121. public Byte getEducate() {
  122. return educate;
  123. }
  124. public void setEducate(Byte educate) {
  125. this.educate = educate;
  126. }
  127. public String getEffect() {
  128. return effect;
  129. }
  130. public void setEffect(String effect) {
  131. this.effect = effect;
  132. }
  133. public String getSummarize() {
  134. return summarize;
  135. }
  136. public void setSummarize(String summarize) {
  137. this.summarize = summarize;
  138. }
  139. public Educate(Long id, String name, String purpose, Date begintime,
  140. Date endtime, String datum, String teacher, String student,
  141. Date createtime, Byte educate, String effect, String summarize) {
  142. this.id = id;
  143. this.name = name;
  144. this.purpose = purpose;
  145. this.begintime = begintime;
  146. this.endtime = endtime;
  147. this.datum = datum;
  148. this.teacher = teacher;
  149. this.student = student;
  150. this.createtime = createtime;
  151. this.educate = educate;
  152. this.effect = effect;
  153. this.summarize = summarize;
  154. }
  155. public Educate() {
  156. }
  157. @Override
  158. public String toString() {
  159. return "Educate [id=" + id + ", name=" + name + ", purpose=" + purpose
  160. + ", begintime=" + begintime + ", endtime=" + endtime
  161. + ", datum=" + datum + ", teacher=" + teacher + ", student="
  162. + student + ", createtime=" + createtime + ", educate="
  163. + educate + ", effect=" + effect + ", summarize=" + summarize
  164. + "]";
  165. }
  166. @Override
  167. public int hashCode() {
  168. final int prime = 31;
  169. int result = 1;
  170. result = prime * result + ((id == null) ? 0 : id.hashCode());
  171. return result;
  172. }
  173. @Override
  174. public boolean equals(Object obj) {
  175. if (this == obj)
  176. return true;
  177. if (obj == null)
  178. return false;
  179. if (getClass() != obj.getClass())
  180. return false;
  181. Educate other = (Educate) obj;
  182. if (id == null) {
  183. if (other.id != null)
  184. return false;
  185. } else if (!id.equals(other.id))
  186. return false;
  187. return true;
  188. }
  189.  
  190. }

需要注意的是,如果是通过spring管理的话,需要在applicationContext.xml文件中的<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">中,配置

<property name="packagesToScan" value="com.ssh.entities"></property>

2.基于配置文件的形式:

需要注意的是,如果是通过spring管理的话,需要在applicationContext.xml文件中的<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">中,配置

<property name="mappingLocations" value="classpath:com/ssh/entities/*.hbm.xml"></property>

User类:

  1. package com.ssh.entities;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Date;
  5. import java.util.HashSet;
  6. import java.util.Set;
  7.  
  8. public class User {
  9. private Long id;//员工编号
  10. private String name;//员工用户名
  11. private String password;//登录密码
  12. private Byte sex;//性别
  13. private Date birthday;//生日
  14. private Date createtime;//创建时间
  15. private Byte isadmin;//是否为管理员
  16. private String content;//人员简介
  17. private Set<Educate> educate=new HashSet<Educate>();
  18. public Set<Educate> getEducate() {
  19. return educate;
  20. }
  21. public void setEducate(Set<Educate> educate) {
  22. this.educate = educate;
  23. }
  24. public Long getId() {
  25. return id;
  26. }
  27. public void setId(Long id) {
  28. this.id = id;
  29. }
  30. public String getName() {
  31. return name;
  32. }
  33. public void setName(String name) {
  34. this.name = name;
  35. }
  36. public String getPassword() {
  37. return password;
  38. }
  39. public void setPassword(String password) {
  40. this.password = password;
  41. }
  42. public Byte getSex() {
  43. return sex;
  44. }
  45. public void setSex(Byte sex) {
  46. this.sex = sex;
  47. }
  48. public Date getBirthday() {
  49. return birthday;
  50. }
  51. public void setBirthday(Date birthday) {
  52. this.birthday = birthday;
  53. }
  54. public Date getCreatetime() {
  55. return createtime;
  56. }
  57. public void setCreatetime(Date createtime) {
  58. this.createtime = createtime;
  59. }
  60. public Byte getIsadmin() {
  61. return isadmin;
  62. }
  63. public void setIsadmin(Byte isadmin) {
  64. this.isadmin = isadmin;
  65. }
  66. public String getContent() {
  67. return content;
  68. }
  69. public void setContent(String content) {
  70. this.content = content;
  71. }
  72. public User(Long id, String name, String password, Byte sex, Date birthday,
  73. Date createtime, Byte isadmin, String content) {
  74. this.id = id;
  75. this.name = name;
  76. this.password = password;
  77. this.sex = sex;
  78. this.birthday = birthday;
  79. this.createtime = createtime;
  80. this.isadmin = isadmin;
  81. this.content = content;
  82. }
  83. public User() {
  84. }
  85. @Override
  86. public String toString() {
  87. return "User [id=" + id + ", name=" + name + ", password=" + password
  88. + ", sex=" + sex + ", birthday=" + birthday + ", createtime="
  89. + createtime + ", isadmin=" + isadmin + ", content=" + content
  90. + "]";
  91. }
  92. @Override
  93. public int hashCode() {
  94. final int prime = 31;
  95. int result = 1;
  96. result = prime * result + ((id == null) ? 0 : id.hashCode());
  97. return result;
  98. }
  99. @Override
  100. public boolean equals(Object obj) {
  101. if (this == obj)
  102. return true;
  103. if (obj == null)
  104. return false;
  105. if (getClass() != obj.getClass())
  106. return false;
  107. User other = (User) obj;
  108. if (id == null) {
  109. if (other.id != null)
  110. return false;
  111. } else if (!id.equals(other.id))
  112. return false;
  113. return true;
  114. }
  115.  
  116. }

Educate类:

  1. package com.ssh.entities;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Date;
  5. import java.util.HashSet;
  6. import java.util.Set;
  7.  
  8. public class Educate {
  9. private Long id;//培训标号
  10. private String name;//培训名称
  11. private String purpose;//培训目的
  12. private Date begintime;//培训开始时间
  13. private Date endtime;//培训结束时间
  14. private String datum;//培训材料
  15. private String teacher;//培训讲师
  16. private String student;//培训人员
  17. private Date createtime;//创建时间
  18. private Byte educate;//培训是否完成
  19. private String effect;//培训效果
  20. private String summarize;//培训总结
  21. private Set<User> user=new HashSet<User>();
  22.  
  23. public Set<User> getUser() {
  24. return user;
  25. }
  26. public void setUser(Set<User> user) {
  27. this.user = user;
  28. }
  29. public Long getId() {
  30. return id;
  31. }
  32. public void setId(Long id) {
  33. this.id = id;
  34. }
  35. public String getName() {
  36. return name;
  37. }
  38. public void setName(String name) {
  39. this.name = name;
  40. }
  41. public String getPurpose() {
  42. return purpose;
  43. }
  44. public void setPurpose(String purpose) {
  45. this.purpose = purpose;
  46. }
  47. public Date getBegintime() {
  48. return begintime;
  49. }
  50. public void setBegintime(Date begintime) {
  51. this.begintime = begintime;
  52. }
  53. public Date getEndtime() {
  54. return endtime;
  55. }
  56. public void setEndtime(Date endtime) {
  57. this.endtime = endtime;
  58. }
  59. public String getDatum() {
  60. return datum;
  61. }
  62. public void setDatum(String datum) {
  63. this.datum = datum;
  64. }
  65. public String getTeacher() {
  66. return teacher;
  67. }
  68. public void setTeacher(String teacher) {
  69. this.teacher = teacher;
  70. }
  71. public String getStudent() {
  72. return student;
  73. }
  74. public void setStudent(String student) {
  75. this.student = student;
  76. }
  77. public Date getCreatetime() {
  78. return createtime;
  79. }
  80. public void setCreatetime(Date createtime) {
  81. this.createtime = createtime;
  82. }
  83. public Byte getEducate() {
  84. return educate;
  85. }
  86. public void setEducate(Byte educate) {
  87. this.educate = educate;
  88. }
  89. public String getEffect() {
  90. return effect;
  91. }
  92. public void setEffect(String effect) {
  93. this.effect = effect;
  94. }
  95. public String getSummarize() {
  96. return summarize;
  97. }
  98. public void setSummarize(String summarize) {
  99. this.summarize = summarize;
  100. }
  101. public Educate(Long id, String name, String purpose, Date begintime,
  102. Date endtime, String datum, String teacher, String student,
  103. Date createtime, Byte educate, String effect, String summarize) {
  104. this.id = id;
  105. this.name = name;
  106. this.purpose = purpose;
  107. this.begintime = begintime;
  108. this.endtime = endtime;
  109. this.datum = datum;
  110. this.teacher = teacher;
  111. this.student = student;
  112. this.createtime = createtime;
  113. this.educate = educate;
  114. this.effect = effect;
  115. this.summarize = summarize;
  116. }
  117. public Educate() {
  118. }
  119. @Override
  120. public String toString() {
  121. return "Educate [id=" + id + ", name=" + name + ", purpose=" + purpose
  122. + ", begintime=" + begintime + ", endtime=" + endtime
  123. + ", datum=" + datum + ", teacher=" + teacher + ", student="
  124. + student + ", createtime=" + createtime + ", educate="
  125. + educate + ", effect=" + effect + ", summarize=" + summarize
  126. + "]";
  127. }
  128. @Override
  129. public int hashCode() {
  130. final int prime = 31;
  131. int result = 1;
  132. result = prime * result + ((id == null) ? 0 : id.hashCode());
  133. return result;
  134. }
  135. @Override
  136. public boolean equals(Object obj) {
  137. if (this == obj)
  138. return true;
  139. if (obj == null)
  140. return false;
  141. if (getClass() != obj.getClass())
  142. return false;
  143. Educate other = (Educate) obj;
  144. if (id == null) {
  145. if (other.id != null)
  146. return false;
  147. } else if (!id.equals(other.id))
  148. return false;
  149. return true;
  150. }
  151.  
  152. }

User.hbm.xml

  1. <?xml version="1.0"?>
  2. <!DOCTYPE hibernate-mapping PUBLIC
  3. "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  4. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  5. <hibernate-mapping>
  6. <class name="com.ssh.entities.User" table="user">
  7. <id column="id" name="id" type="java.lang.Long">
  8. <generator class="native"></generator>
  9. </id>
  10. <property name="name" length="50" type="java.lang.String"/>
  11. <property name="password" length="50" type="java.lang.String"/>
  12. <property name="sex" length="4" type="java.lang.Byte"/>
  13. <property name="birthday" length="23" type="java.util.Date"/>
  14. <property name="createtime" length="23" type="java.util.Date"/>
  15. <property name="isadmin" length="4" type="java.lang.Byte"/>
  16. <property name="content" length="2000" type="java.lang.String"/>
  17. <set name="educate" table="user_educate" lazy="false" cascade="all" inverse="false">
  18. <key column="user_id"></key>
  19. <many-to-many class="com.ssh.entities.Educate" column="educate_id"></many-to-many>
  20. </set>
  21. </class>
  22. </hibernate-mapping>

Educate.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.ssh.entities.Educate" table="educate">
<id column="id" name="id" type="java.lang.Long">
<generator class="native"></generator>
</id>
<property name="name" length="100" type="java.lang.String"></property>
<property name="purpose" length="500" type="java.lang.String"/>
<property name="begintime" length="23" type="java.util.Date"/>
<property name="endtime" length="23" type="java.util.Date"/>
<property name="datum" length="2000" type="java.lang.String"/>
<property name="teacher" length="50" type="java.lang.String"/>
<property name="student" length="50" type="java.lang.String"/>
<property name="createtime" length="23" type="java.util.Date"/>
<property name="effect" length="500" type="java.lang.String"/>
<property name="educate" length="1" type="java.lang.Byte"/>
<property name="summarize" length="2000" type="java.lang.String"/>
<set name="user" table="user_educate" lazy="true" cascade="all" inverse="true">
<key column="educate_id"></key>
<many-to-many class="com.ssh.entities.User" column="user_id"></many-to-many>
</set>
</class>
</hibernate-mapping>

Hibernate 注解和配置文件两种方法的对比(有实例)的更多相关文章

  1. jQuery中清空元素.empty()和.html(''),两种方法的对比

    jQuery 中有 .empty() 和 .html() 两种方式,都能够清空所选父元素中的所有子元素.但是这两者清空元素的方式上,有着很大的区别: 1.empty() jQuery对象.empty( ...

  2. mybatis学习之路----批量更新数据两种方法效率对比

    原文:https://blog.csdn.net/xu1916659422/article/details/77971696/ 上节探讨了批量新增数据,这节探讨批量更新数据两种写法的效率问题. 实现方 ...

  3. java web 读取配置文件两种方法

    package com.tsinghua.getDataBaseConn; import java.io.IOException;import java.io.InputStream;import j ...

  4. Oracle中spool命令实现的两种方法比较

    ---恢复内容开始--- 要输出符合要求格式的数据文件只需在select时用字符连接来规范格式.比如有如下表 SQL>; select id,username,password from myu ...

  5. Java代码中获取配置文件(config.properties)中内容的两种方法

    方法千千万,本人暂时只总结了两种方法. (1)config.properties中的内容如图 在applicationContext.xml中配置 <!-- 引入配置文件 --> < ...

  6. Java 获取*.properties配置文件中的内容 ,常见的两种方法

    import java.io.InputStream; import java.util.Enumeration; import java.util.List; import java.util.Pr ...

  7. spring 配置文件 引入外部的property文件的两种方法

    spring  的配置文件 引入外部的property文件的两种方法 <!-- 引入jdbc配置文件    方法一 --> <bean id="propertyConfig ...

  8. centos lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress 安装phpmyadmin 定时备份mysql两种方法 第二十五节课

    centos  lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress  安装phpmyadmin  定时备份mysql两种方法  第二十五节 ...

  9. 【mybatis基础】mybatis开发dao两种方法

    mybatis是一个支持普通SQL查询,存储过程和高级映射的优秀的持久层的框架,是apache下的顶级项目.mybatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.mybat ...

随机推荐

  1. java heap space解决方法和JVM参数设置

    在JVM中如果98%的时间是用于GC(Garbage Collection)且可用的 Heap size 不足2%的时候将抛出异常信息,java.lang.OutOfMemoryError: Java ...

  2. win10磁盘碎片整理

    如果我们想要加快win10系统运行速度的话,就需要定期整理碎片才可以,减少卡顿,提高性能. 一:注意事项 固态硬盘用户千万不要使用‘磁盘碎片整理功能’,因为使用的技术不一样,使用window自带的该功 ...

  3. 45. Jump Game II (Array; Two-Pointers,Greedy)

    Given an array of non-negative integers, you are initially positioned at the first index of the arra ...

  4. Mac下MySQL卸载方法

    mac下mysql的DMG格式安装内有安装文件,却没有卸载文件……很郁闷的事.1 sudo rm /usr/local/mysql2 sudo rm -rf /usr/local/mysql*3 su ...

  5. 121. Best Time to Buy and Sell Stock买卖股票12

    一 [抄题]: If you were only permitted to complete at most one transaction (ie, buy one and sell one sha ...

  6. iPhone iPad 各种控件默认高度

    iPhone和iPad下各种常见控件的宽度和标准是一样的,所以这里就用iPhone说明. 以下是常见的几种控件的高度.Statusbar,Navigationbar和Tabbar的宽度极其图标大小. ...

  7. 什么场景应该用 MongoDB(转)

    很多人比较关心 MongoDB 的适用场景,也有用户在话题里分享了自己的业务场景,比如: 案例1 用在应用服务器的日志记录,查找起来比文本灵活,导出也很方便.也是给应用练手,从外围系统开始使用Mong ...

  8. springboot的yaml基础语法与取值,配置类,配置文件加载优先级

    1.基本语法k:(空格)v:表示一对键值对(一个空格必须有):以空格的缩进来控制层级关系:只要是左对齐的一列数据,都是同一个层级的属性和值也是大小写敏感: server: port: 8081 pat ...

  9. 在java工程中导入jar包的注意事项

    在java工程中导入jar包后一定要bulid path,不然jar包不可以用.而在java web工程中导入jar包后可以不builld path,但最好builld path.

  10. 在探http请求

    参考:https://itbilu.com/other/relate/Ny2IWC3N-.html Cookie和Session都是为了解决HTTP协议的无状态问题,存储HTTP通讯中客户端与服务器之 ...