当前位置:编程学习 > JAVA >>

java web分页查询初试

ssh2分页查询初试,放着记录学习一下。


entity:student.java:


[html]
package com.zte.entity; 
 
/** 
 * 数据持久化,跟数据库的的相应的表的字段是对应的。 
 *  
 *  
 */ 
public class Student 

 
    private Integer id; 
 
    private String name; 
 
    private Integer age; 
 
    private Integer score; 
 
    private String email; 
 
    private String phone; 
 
    public String getEmail() 
    { 
        return email; 
    } 
 
    public void setEmail(String email) 
    { 
        this.email = email; 
    } 
 
    public String getPhone() 
    { 
        return phone; 
    } 
 
    public void setPhone(String phone) 
    { 
        this.phone = phone; 
    } 
 
    public Integer getId() 
    { 
        return id; 
    } 
 
    public void setId(Integer id) 
    { 
        this.id = id; 
    } 
 
    public String getName() 
    { 
        return name; 
    } 
 
    public void setName(String name) 
    { 
        this.name = name; 
    } 
 
    public Integer getAge() 
    { 
        return age; 
    } 
 
    public void setAge(Integer age) 
    { 
        this.age = age; 
    } 
 
    public Integer getScore() 
    { 
        return score; 
    } 
 
    public void setScore(Integer score) 
    { 
        this.score = score; 
    } 
 

package com.zte.entity;

/**
 * 数据持久化,跟数据库的的相应的表的字段是对应的。
 *
 *
 */
public class Student
{

 private Integer id;

 private String name;

 private Integer age;

 private Integer score;

 private String email;

 private String phone;

 public String getEmail()
 {
  return email;
 }

 public void setEmail(String email)
 {
  this.email = email;
 }

 public String getPhone()
 {
  return phone;
 }

 public void setPhone(String phone)
 {
  this.phone = phone;
 }

 public Integer getId()
 {
  return id;
 }

 public void setId(Integer id)
 {
  this.id = id;
 }

 public String getName()
 {
  return name;
 }

 public void setName(String name)
 {
  this.name = name;
 }

 public Integer getAge()
 {
  return age;
 }

 public void setAge(Integer age)
 {
  this.age = age;
 }

 public Integer getScore()
 {
  return score;
 }

 public void setScore(Integer score)
 {
  this.score = score;
 }

}
Student.hbm.xml:


[html] 
<?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 package="com.zte.entity"> 
    <class name="Student" table="student"> 
        <id name="id" column="id" type="java.lang.Integer"> 
            <generator class="identity"> 
            </generator> 
        </id> 
        <property name="name" column="name" type="java.lang.String"></property> 
        <property name="age" column="age" type="java.lang.Integer"></property> 
        <property name="score" column="score" type="java.lang.Integer"></property> 
        <property name="email" column="email" type="java.lang.String"></property> 
        <property name="phone" column="phone" type="java.lang.String"></property> 
    </class> 
</hibernate-mapping> 

<?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 package="com.zte.entity">
 <class name="Student" table="student">
  <id name="id" column="id" type="java.lang.Integer">
   <generator class="identity">
   </generator>
  </id>
  <property name="name" column="name" type="java.lang.String"></property>
  <property name="age" column="age" type="java.lang.Integer"></property>
  <property name="score" column="score" type="java.lang.Integer"></property>
  <property name="email" column="email" type="java.lang.String"></property>
  <property name="phone" co

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,