10:34:20,187  INFO Configuration: Reading mappings from resource: com/iustice/User.hbm.xml10:34:20,250 ERROR XMLHelper: Error parsing XML: XML InputStream(7) The content of element type "id" must match "(meta*,column*,type?,generator?)".10:34:20,250 ERROR XMLHelper: Error parsing XML: XML InputStream(10) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natu
<?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 package="com.iustice">
<class name="User" table="user">
<id name="id" column="id">
 <generator class="identity"></generator>
</id>
<property name="username" column="username"  unique="true"/>
<property name="password" column="password" />
</class>
</hibernate-mapping><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration><session-factory>
<property name="connection.url">jdbc:mysql://localhost/user</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.username">root</property>
<property name="connection.password">002312708</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.pool_size">10</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<!--
<property name="hbm2ddl.auto">create</property>
-->
<mapping resource="com/iustice/User.hbm.xml" /></session-factory></hibernate-configuration>
ublic class User implements Serializable {
    private long id;
    private String username;
    private String password;
    public User(){}
    public String getPassword() {
         return password;
     }     public void setPassword(String password) {
         this.password = password;
     }     public void setUsername(String username) {
         this.username = username;
     }
     public String getUsername() {
         return username;
     }
     public  long  getId(){
         return  id;
     }
     public  void  setId(long id){
         this.id=id;
     }
}public class Login extends ActionForm {
    private String password;
    private String username;
    public String getPassword() {
        return password;
    }    public void setPassword(String password) {
        this.password = password;
    }    public void setUsername(String username) {
        this.username = username;
    }
    public String getUsername() {
        return username;
    }    public ActionErrors validate(ActionMapping actionMapping,
                                 HttpServletRequest httpServletRequest) {
            /** @todo: finish this method, this is just the skeleton.*/
        return null;
    }    public void reset(ActionMapping actionMapping,
                      HttpServletRequest servletRequest) {
    }
}
public class LoginAction extends Action {
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws
            NoSuchMethodException, InvocationTargetException,
            IllegalAccessException {
        String username=(String)PropertyUtils.getSimpleProperty(form,"username");
        String password=(String)PropertyUtils.getSimpleProperty(form,"password");
        Session s=HibernateUtil.currentionSession();
        Query q=s.createQuery("from User u where u.username='"+username+"' and password='"+password+"'");
        if(q.list().isEmpty()){
            HibernateUtil.closeSession();
            return(mapping.findForward("loginfail"));
        }
        else{
             HibernateUtil.closeSession();
             request.getSession().setAttribute(username,username);
             return mapping.findForward("loginsuccess");
        }
    }}