----------------------------------------------------/SSHTest/src
----------------------------------------------------/com.zyl.hiber.dao
------------------------//SSHTest/src/com/zyl/hiber/dao/IUsersDAO.java


package com.zyl.hiber.dao;

import java.util.List;

import org.hibernate.HibernateException;

import com.zyl.hiber.po.Users;

public interface IUsersDAO {
/*
	public Users findUsersByProperties(String username, String password)
			throws HibernateException;
*/
	//public void saveUsers(Users users) throws HibernateException;
//	public Users findByName(String username);
	//public List<String> findByProperty(String username);
}
------------------------------------------------com.zyl.hiber.daoimpl
------------------/SSHTest/src/com/zyl/hiber/daoimpl/UsersDAOImpl.java

package com.zyl.hiber.daoimpl;

import java.util.List;

import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.zyl.hiber.SessionFactory.HibernateSessionFactory;
import com.zyl.hiber.dao.IUsersDAO;
import com.zyl.hiber.po.Users;

public class UsersDAOImpl implements IUsersDAO {

	public List<Long> findByProperty(String username, String password) {
		Session session = HibernateSessionFactory.getSession();
		Transaction trans = session.beginTransaction();

		Query query = session
				.createQuery("select u.usersid from Users u where username=? and password=?");
		query.setString(0, username);
		query.setString(1, password);
		List<Long> userId = query.list();
		trans.commit();
		session.close();
		return userId;

	}

	public List<Users> findByName(String usernames) {
		Session session = HibernateSessionFactory.getSession();
		Transaction trans = session.beginTransaction();

		Query query = session
				.createQuery("select u from Users u where username=?");
		query.setString(0, usernames);
		List<Users> user =query.list();

		trans.commit();
		session.close();
		return user;
	}
	public void save(Users users){
		Session session =HibernateSessionFactory.getSession();
		Transaction trans = session.beginTransaction();
		session.save(users);
		trans.commit();
		session.close();
	}
	public List<Users> findAllUsers(){
		Session session =HibernateSessionFactory.getSession();
		Transaction trans =session.beginTransaction();
		Query query =session.createQuery("select u from Users u order by u.usersid asc");
		List<Users> users = query.list();
		trans.commit();
		session.close();
		return users;
	}
	public Users findById(Long id){
		Session session =HibernateSessionFactory.getSession();
		Transaction trans = session.beginTransaction();
		Users users = (Users)session.load(com.zyl.hiber.po.Users.class, id);
		if(!Hibernate.isInitialized(users))Hibernate.initialize(users);
		users.toString();
		trans.commit();
		session.close();
		return users;
	}
	public void delete(Users users){
		Session session = HibernateSessionFactory.getSession();
		Transaction trans = session.beginTransaction();
		session.delete(users);
		trans.commit();
		session.close();
	}
	public void update(Users users){
		Session session =HibernateSessionFactory.getSession();
		Transaction trans= session.beginTransaction();
		session.update(users);
		trans.commit();
		session.close();

	}
	public List<String> findBypassword(String password){
		Session session = HibernateSessionFactory.getSession();
		Transaction trans= session.beginTransaction();
		Query query = session.createQuery("select u from Users u where u.password=?");
		query.setString(0,password);
		List<String> users =query.list();
		trans.commit();
		session.close();
		return users;

	}
}
-----------------/SSHTest/src/com/zyl/hiber/daoimpl/UsersTestCase.java


package com.zyl.hiber.daoimpl;

import java.util.List;

import org.junit.Assert;
import org.junit.Test;

import com.zyl.hiber.dao.IUsersDAO;
import com.zyl.hiber.po.Users;

public class UsersTestCase {
	//@Test
	public void saveTest() {
		Users users = new Users("xxx", "xxx");
		UsersDAOImpl usersDao = new UsersDAOImpl();
		usersDao.save(users);

	}

	// @Test
	public void findByAllUsersTest() {
		UsersDAOImpl usersDao = new UsersDAOImpl();
		List<Users> users = usersDao.findAllUsers();
		for (Users user : users) {
			System.out.println(user);
		}

	}

	// @Test
	public void findByIdTest() {
		UsersDAOImpl usersDao = new UsersDAOImpl();
		Users user = usersDao.findById(1L);
		System.out.println(user.toString());
	}

	//@Test
	public void deleteTest() {

		UsersDAOImpl usersDao = new UsersDAOImpl();
		Users user = usersDao.findById(24L);
		usersDao.delete(user);
	}
	//@Test
	public void deleteByNameTest() {
		//Users users = new Users("xxx", null);
		UsersDAOImpl usersDao = new UsersDAOImpl();
		List<Users> user = usersDao.findByName("fff");
		usersDao.delete(user.get(0));
	}

	//@Test
	public void findByNameTest(){
		//Users users = new Users("xxx",null);
		UsersDAOImpl userDao = new UsersDAOImpl();
		List<Users> user=userDao.findByName("xxx");
			System.out.println(user);
		Assert.assertNotNull("查询错误",user);
	}

	// @Test
	public void validationLoginTest() {
		UsersDAOImpl user = new UsersDAOImpl();

		List<Long> userId = user.findByProperty("zyl", "123");
		Assert.assertEquals(1, userId.size());
		System.out.println(userId);
	}
	//@Test
	public void updateByIdTest(){
		UsersDAOImpl usersDao=new UsersDAOImpl();
		Users users=usersDao.findById(3L);
		users.setUsername("yyy");
		usersDao.update(users);
		System.out.println(users);

	}
	//@Test
	public void updateByNameTest(){
		UsersDAOImpl usersDao=new UsersDAOImpl();

		List<Users> user=usersDao.findByName("xxx");
		Users users=user.get(0);
		users.setUsername("yyy");
		usersDao.update(users);
		System.out.println(users);

	}

}

------------------------------------com.zyl.hiber.po
------------------------/SSHTest/src/com/zyl/hiber/po/Users.java
package com.zyl.hiber.po;

import java.util.Date;

public class Users implements java.io.Serializable {

	// Fields
	private Long usersid;
	private String username;
	private String password;
	public Users() {
		super();
	}
	public Users(Long usersid, String username, String password) {
		super();
		this.usersid = usersid;
		this.username = username;
		this.password = password;
	}
	public Users(String username, String password) {
		super();
		this.username = username;
		this.password = password;
	}
	public Long getUsersid() {
		return usersid;
	}
	public void setUsersid(Long usersid) {
		this.usersid = usersid;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	@Override
	public String toString() {
		return "Users [password=" + password + ", username=" + username
				+ ", usersid=" + usersid + "]";
	}

}
-----------------------/SSHTest/src/com/zyl/hiber/po/Users.hbm.xml

<?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">
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.zyl.hiber.po.Users" table="T_USERS" schema="zyl">
        <id name="usersid" type="long">
            <column name="USERSID" />
            <generator class="identity" />
        </id>
        <property name="username" type="string">
            <column name="USERNAME" length="123" />
        </property>
        <property name="password" type="string">
            <column name="PASSWORD" />
        </property>
    </class>
</hibernate-mapping>
------------------------------------com.zyl.hiber.SessionFactory
--------/SSHTest/src/com/zyl/hiber/SessionFactory/HibernateSessionFactory.java


package com.zyl.hiber.SessionFactory;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;

/**
 * Configures and provides access to Hibernate sessions, tied to the
 * current thread of execution.  Follows the Thread Local Session
 * pattern, see {@link http://hibernate.org/42.html }.
 */
public class HibernateSessionFactory {

    /** 
     * Location of hibernate.cfg.xml file.
     * Location should be on the classpath as Hibernate uses  
     * #resourceAsStream style lookup for its configuration file. 
     * The default classpath location of the hibernate config file is 
     * in the default package. Use #setConfigFile() to update 
     * the location of the configuration file for the current session.   
     */
    private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
	private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
    private  static Configuration configuration = new Configuration();    
    private static org.hibernate.SessionFactory sessionFactory;
    private static String configFile = CONFIG_FILE_LOCATION;

	static {
    	try {
			configuration.configure(configFile);
			sessionFactory = configuration.buildSessionFactory();
		} catch (Exception e) {
			System.err
					.println("%%%% Error Creating SessionFactory %%%%");
			e.printStackTrace();
		}
    }
    private HibernateSessionFactory() {
    }

	/**
     * Returns the ThreadLocal Session instance.  Lazy initialize
     * the <code>SessionFactory</code> if needed.
     *
     *  @return Session
     *  @throws HibernateException
     */
    public static Session getSession() throws HibernateException {
        Session session = (Session) threadLocal.get();

		if (session == null || !session.isOpen()) {
			if (sessionFactory == null) {
				rebuildSessionFactory();
			}
			session = (sessionFactory != null) ? sessionFactory.openSession()
					: null;
			threadLocal.set(session);
		}

        return session;
    }

	/**
     *  Rebuild hibernate session factory
     *
     */
	public static void rebuildSessionFactory() {
		try {
			configuration.configure(configFile);
			sessionFactory = configuration.buildSessionFactory();
		} catch (Exception e) {
			System.err
					.println("%%%% Error Creating SessionFactory %%%%");
			e.printStackTrace();
		}
	}

	/**
     *  Close the single hibernate session instance.
     *
     *  @throws HibernateException
     */
    public static void closeSession() throws HibernateException {
        Session session = (Session) threadLocal.get();
        threadLocal.set(null);

        if (session != null) {
            session.close();
        }
    }

	/**
     *  return session factory
     *
     */
	public static org.hibernate.SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	/**
     *  return session factory
     *
     *	session factory will be rebuilded in the next call
     */
	public static void setConfigFile(String configFile) {
		HibernateSessionFactory.configFile = configFile;
		sessionFactory = null;
	}

	/**
     *  return hibernate configuration
     *
     */
	public static Configuration getConfiguration() {
		return configuration;
	}

}


------------------------------------com.zyl.spring.service
------------------/SSHTest/src/com/zyl/spring/service/IUserService.java
package com.zyl.spring.service;

public interface IUserService {

}

------------------com.zyl.spring.service.impl
---------/SSHTest/src/com/zyl/spring/service/impl/UserServiceImpl.java
package com.zyl.spring.service.impl;

import java.util.List;

import com.zyl.hiber.daoimpl.UsersDAOImpl;
import com.zyl.hiber.po.Users;
import com.zyl.spring.service.IUserService;

public class UserServiceImpl implements IUserService {

	public Boolean validateLogin(String username, String password) {

		UsersDAOImpl userDao = new UsersDAOImpl();
		List<Long> userId = userDao.findByProperty(username, password);
		if (userId != null && userId.size() != 0) {
			return true;
		} else {
			return false;
		}
	}

	public boolean saveService(Users users) {

		UsersDAOImpl userDao = new UsersDAOImpl();
		userDao.save(users);
		List<Users> isfinded = userDao.findByName(users.getUsername());

		if (isfinded == null && isfinded.get(0) != null) {
			return false;
		} else {
			return true;

		}

	}

	public List<Users> findAllUsers() {
		UsersDAOImpl usersDao = new UsersDAOImpl();
		List<Users> allUsers = usersDao.findAllUsers();
		return allUsers;
	}

	public void deleteService(Long usersid) {
		UsersDAOImpl usersDao = new UsersDAOImpl();
		Users user = usersDao.findById(usersid);
		usersDao.delete(user);


	}


	public void updateRedirectService(Long usersid) {
		UsersDAOImpl usersDao=new UsersDAOImpl();
		Users users=usersDao.findById(usersid);
		users=usersDao.findById(usersid);
	}
	public void updateService(Long usersid,String username,String password) {
		UsersDAOImpl usersDao=new UsersDAOImpl();
		Users users=usersDao.findById(usersid);
		users.setUsername(username);
		users.setPassword(password);
		usersDao.update(users);
	}
}


----------------------------------------com.zyl.struts.action
----------------/SSHTest/src/com/zyl/struts/action/AddUserAction.java

package com.zyl.struts.action;

import com.zyl.hiber.po.Users;
import com.zyl.spring.service.impl.UserServiceImpl;

public class AddUserAction{

	private Users users;
	public Users getUsers() {
		return users;
	}
	public void setUsers(Users users) {
		this.users = users;
	}
	public String execute() {

		UserServiceImpl userService = new UserServiceImpl();
		Users user =new Users(users.getUsername(),users.getPassword());
		Boolean isSaved=userService.saveService(user);
		if(isSaved==true){
			return "login";
		}else{
			return "addFailed";
		}
	}

}




-------------/SSHTest/src/com/zyl/struts/action/DeleteUserAction.java
package com.zyl.struts.action;

import com.zyl.hiber.po.Users;
import com.zyl.spring.service.impl.UserServiceImpl;

public class DeleteUserAction {
	private Users users;
	private Long usersid;
	public Users getUsers() {
		return users;
	}
	public Long getUsersid() {
		return usersid;
	}
	public void setUsersid(Long usersid) {
		this.usersid = usersid;
	}
	public void setUsers(Users users) {
		this.users = users;
	}
	public String execute() {
		UserServiceImpl userService=new UserServiceImpl();
		 userService.deleteService(usersid);
		  System.out.println(usersid);
		 return "allUsers";
	}
}

--------/SSHTest/src/com/zyl/struts/action/FindAllUserAction.java
package com.zyl.struts.action;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.zyl.spring.service.impl.UserServiceImpl;

public class FindAllUserAction {

	public String execute() {

		UserServiceImpl userService = new UserServiceImpl();
		Map request = (Map) ActionContext.getContext().get("request");
		request.put("list", userService.findAllUsers());
		return "allUsers";
	}
}

--------/SSHTest/src/com/zyl/struts/action/LoginAction.java
package com.zyl.struts.action;

import com.zyl.hiber.po.Users;
import com.zyl.spring.service.impl.UserServiceImpl;

public class LoginAction{

	private Users users;
	public Users getUsers() {
		return users;
	}

	public void setUsers(Users users) {
		this.users = users;
	}

	public String execute() {

		UserServiceImpl loginService= new UserServiceImpl(); 
		Boolean isFound = loginService.validateLogin(users.getUsername(),users.getPassword());
		if(isFound==true){
			return "success";
		}else{
			return "login";
		}
	}

}



--------/SSHTest/src/com/zyl/struts/action/UpdateRedirectAction.java
package com.zyl.struts.action;

import com.zyl.hiber.daoimpl.UsersDAOImpl;
import com.zyl.hiber.po.Users;
import com.zyl.spring.service.impl.UserServiceImpl;
import com.zyl.spring.service.impl.UserServiceImplTest;

public class UpdateRedirectAction {
	private Long usersid;

	public Long getUsersid() {
		return usersid;
	}

	public void setUsersid(Long usersid) {
		this.usersid = usersid;
	}

	public String execute() {
		Users users = new Users();
		UserServiceImpl userService = new UserServiceImpl();
		userService.updateRedirectService(usersid);
		System.out.println(users);

		return "update";
	}
}

--------/SSHTest/src/com/zyl/struts/action/UpdateUserAction.java
package com.zyl.struts.action;

import com.zyl.hiber.daoimpl.UsersDAOImpl;
import com.zyl.hiber.po.Users;
import com.zyl.spring.service.impl.UserServiceImpl;
import com.zyl.spring.service.impl.UserServiceImplTest;

public class UpdateUserAction{
	private Long usersid;
	private String username;
	private String password;
public Long getUsersid() {
		return usersid;
	}
	public void setUsersid(Long usersid) {
		this.usersid = usersid;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
public String execute() {

	 UserServiceImpl userService=new UserServiceImpl();
	  userService.updateService(usersid, username, password);
	  return "allUsers";
  }
}



-----------------------------------------------------com.zyl.util
--------------------------------/SSHTest/src/com/zyl/util/ToDDL.java
package com.zyl.util;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class ToDDL {
	public static void main(String[] args) {
		Configuration configure = new Configuration();
		configure.configure("hibernate.cfg.xml");
		SchemaExport sc = new SchemaExport(configure);
		sc.create(true, true);
	}
}

----------------------------------------/SSHTest/src/hibernate.cfg.xml
<?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="dialect">
			org.hibernate.dialect.DB2Dialect
		</property>
		<property name="connection.url">
			jdbc:db2://192.168.25.230:50000/JSAMPLE
		</property>
		<property name="connection.username">zyl</property>
		<property name="connection.password">123</property>
		<property name="connection.driver_class">
			com.ibm.db2.jcc.DB2Driver
		</property>
		<property name="myeclipse.connection.profile">zyl</property>
		<mapping resource="com/zyl/hiber/po/Users.hbm.xml" />
	</session-factory>

</hibernate-configuration>
----------------------------------------/SSHTest/src/log4j.properties
log4j.rootLogger=ERROR,A1
log4j.appender.A1 = org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.TTCCLayout
--------------------------------/SSHTest/src/struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
	<package name="Pck" extends="struts-default">

		<action name="LoginAction" class="com.zyl.struts.action.LoginAction">

			<result name="success">/success.jsp</result>
			<result name="login" type="redirect">/index.jsp</result>


		</action>
		<action name="AddUserAction" class="com.zyl.struts.action.AddUserAction">
			<result name="addFailed">/failed.jsp</result>
			<result name="login" type="redirect">/index.jsp</result>
		</action>
		<action name="FindAllusersAction" class="com.zyl.struts.action.FindAllUserAction">
			<result name="allUsers">/allusers.jsp</result>
		</action>


		<action name="DeleteUserAction" class="com.zyl.struts.action.DeleteUserAction">
			<result name="allUsers" type="redirect">/FindAllusersAction.action
			</result>
		</action>


		<action name="UpdateRedirectAction" class="com.zyl.struts.action.UpdateRedirectAction">
			<result name="update">/update.jsp</result>
		</action>

		<action name="UpdateUserAction" class="com.zyl.struts.action.UpdateUserAction">
			<result name="allUsers" type="redirect">/FindAllusersAction.action
			</result>
		</action>


	</package>

</struts>    

------------------------------------------------/SSHTest/WebRoot
------------------------/SSHTest/WebRoot/META-INF
--------------------------------/SSHTest/WebRoot/WEB-INF/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">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <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></web-app>

----------------------------------------/SSHTest/WebRoot/adduser.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'index.jsp' starting page</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	</head>

	<body>
		<form action="AddUserAction.action" method="post">
			<table align="center">
				姓名:<input type="text" name="users.username" />
				<br>
				密码:<input type="password" name="users.password" />
				<br>
				<input type="submit"><input type="reset"/>
		</form>
		</table>
	</body>
</html>

----------------------------------------/SSHTest/WebRoot/allusers.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'success.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>
	<body>
		欢迎
		<s:property value="users.username" />
		<table align="center">
			<form>
				<s:iterator value="#request.list">
					<tr>
						<td>
							<s:property value="usersid" />
						</td>
						<td>
							<s:property value="username" />
						</td>
						<td>
							<s:property value="password" />
						</td>

						<td>
							<s:a href="DeleteUserAction.action?usersid=%{usersid}">delete</s:a>
						</td>

						<td>
							<s:a href="UpdateRedirectAction.action?usersid=%{usersid}">update</s:a>
						</td>
					</tr>
				</s:iterator>

			</form>
		</table>

	</body>
</html>

----------------------------------------/SSHTest/WebRoot/failed.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"  %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP 'success.jsp' starting page</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>

  <body><table align="center">
<s:property value="users.username"/>
<s:property value="users.password"/>
<%out.print("失败");%>
</table>
  </body>
</html>

----------------------------------------/SSHTest/WebRoot/index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'index.jsp' starting page</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	</head>

	<body>
		<form action="LoginAction.action" method="post">

			<table align="center">
				姓名:<input type="text" name="users.username" />
				<br>
				密码:<input type="password" name="users.password" />
				<br>
				<input type="submit" value="提交"><input type="reset" value="重置"/>
		</form>
		<a href="adduser.jsp">保存用户</a>
		</table>

	</body>


</html>

----------------------------------------/SSHTest/WebRoot/success.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'success.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>
	<body>
		<table align="center">
			欢迎
			<s:property value="users.username" />
			<form>
				<a href="FindAllusersAction.action">所有用户</a>
			</form>
		</table>
	</body>
</html>

----------------------------------------/SSHTest/WebRoot/update.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP 'update.jsp' starting page</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>

  <body>

  Update User

    <s:form action="UpdateUserAction">

    	<table>
    		<tr>
    			<td>
    				<s:hidden name="usersid" value="%{usersid}"></s:hidden>
    			</td>
    		</tr>

    		<tr>
    			<td>
    				<s:textfield name="username" value="%{username}" label="%{getText('username')}"></s:textfield>
    			</td>
    		</tr>

    		<tr>
    			<td>
    				<s:textfield name="password" value="%{password}" label="%{getText('password')}"></s:textfield>
    			</td>
    		</tr>
    		<tr>
    			<td>
    				<s:submit></s:submit>
    			</td>
    		</tr>
    	</table>

    </s:form>

  </body>
</html>

-------------------------------------------

/SSHTest/src
com.zyl.hiber.dao
/SSHTest/src/com/zyl/hiber/dao/IUsersDAO.java
com.zyl.hiber.daoimpl
/SSHTest/src/com/zyl/hiber/daoimpl/UsersDAOImpl.java
/SSHTest/src/com/zyl/hiber/daoimpl/UsersTestCase.java
com.zyl.hiber.po
/SSHTest/src/com/zyl/hiber/po/Users.java
/SSHTest/src/com/zyl/hiber/po/Users.hbm.xml
com.zyl.hiber.SessionFactory
/SSHTest/src/com/zyl/hiber/SessionFactory/HibernateSessionFactory.java
com.zyl.spring.service
/SSHTest/src/com/zyl/spring/service/IUserService.java
com.zyl.spring.service.impl
/SSHTest/src/com/zyl/spring/service/impl/UserServiceImpl.java
/SSHTest/src/com/zyl/spring/service/impl/UserServiceImplTest.java
com.zyl.struts.action
/SSHTest/src/com/zyl/struts/action/AddUserAction.java
/SSHTest/src/com/zyl/struts/action/DeleteUserAction.java
/SSHTest/src/com/zyl/struts/action/FindAllUserAction.java
/SSHTest/src/com/zyl/struts/action/LoginAction.java
/SSHTest/src/com/zyl/struts/action/UpdateRedirectAction.java
/SSHTest/src/com/zyl/struts/action/UpdateUserAction.java
com.zyl.util
/SSHTest/src/com/zyl/util/ToDDL.java
/SSHTest/src/hibernate.cfg.xml
/SSHTest/src/log4j.properties
/SSHTest/src/struts.xml

/SSHTest/WebRoot
/SSHTest/WebRoot/META-INF
/SSHTest/WebRoot/WEB-INF
/SSHTest/WebRoot/WEB-INF/lib
/SSHTest/WebRoot/WEB-INF/web.xml
/SSHTest/WebRoot/adduser.jsp
/SSHTest/WebRoot/allusers.jsp
/SSHTest/WebRoot/failed.jsp
/SSHTest/WebRoot/index.jsp
/SSHTest/WebRoot/success.jsp
/SSHTest/WebRoot/update.jsp

-------------------------------------------------------------------
C:\Java\jdk1.6.0_01\jre\lib\resources.jar
C:\Java\jdk1.6.0_01\jre\lib\rt.jar
C:\Java\jdk1.6.0_01\jre\lib\jsse.jar
C:\Java\jdk1.6.0_01\jre\lib\jce.jar
C:\Java\jdk1.6.0_01\jre\lib\charsets.jar
C:\Java\jdk1.6.0_01\jre\lib\ext\dnsns.jar
C:\Java\jdk1.6.0_01\jre\lib\ext\localedata.jar
C:\Java\jdk1.6.0_01\jre\lib\ext\sunjce_provider.jar
C:\Java\jdk1.6.0_01\jre\lib\ext\sunmscapi.jar
C:\Java\jdk1.6.0_01\jre\lib\ext\sunpkcs11.jar
C:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.6.0.me201007292038\data\libraryset\EE_5\javaee.jar
C:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.6.0.me201007292038\data\libraryset\EE_5\jsf-impl.jar
C:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.6.0.me201007292038\data\libraryset\EE_5\jsf-api.jar
C:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.j2eedt.core_8.6.0.me201007292038\data\libraryset\EE_5\jstl-1.2.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\commons-collections-3.2.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\commons-fileupload-1.2.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\commons-io-1.3.2.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\commons-logging-api-1.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\freemarker-2.3.15.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\struts2-convention-plugin-2.1.8.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\struts2-core-2.1.8.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\111\1\.cp\data\2.1\core\xwork-core-2.1.6.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\entitymanager\hibernate-annotations.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\entitymanager\hibernate-commons-annotations.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\entitymanager\hibernate-entitymanager.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\hibernate-validator.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\entitymanager\ejb3-persistence.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\bytecode\cglib\cglib-2.2.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\bytecode\javassist\javassist-3.9.0.GA.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.2\lib\antlr-2.7.6.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\required\commons-collections-3.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\hibernate3.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\required\jta-1.1.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.2\lib\ehcache-1.2.3.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\required\slf4j-api-1.5.8.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\required\slf4j-log4j12-1.5.8.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.3\lib\required\log4j-1.2.14.jar
C:\Program Files\Genuitec\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\91\1\.cp\myeclipse-data\3.1\lib\dom4j-1.6.1.jar
------------------------------------
T_USERS
主键	USERSID	BIGINT	8	否
	USERNAME	VARCHAR	123	是
	PASSWORD	VARCHAR	255	是