Java的SSH网站

1、框架

  strusts2 + Hibernate + spring

2、图片

  

    图1-1 网站结构

  

    图1-2 java代码结构

3、源代码

3.1 UserAction.java

package com.xhu.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

import org.apache.struts2.interceptor.SessionAware;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.opensymphony.xwork2.ActionSupport;

import com.xhu.DTO.PwdDto;
import com.xhu.model.Place;
import com.xhu.model.User;
import com.xhu.model.UserType;
import com.xhu.model.PageResultSet;
import com.xhu.service.PlaceManager;
import com.xhu.service.UserManager;
import com.xhu.util.MD5;

@Component("userAction")
@Scope("prototype")
public class UserAction extends ActionSupport implements SessionAware {
    /**
     * 
     */
    private static final long serialVersionUID = 2566144909692829328L;
    /**
     * 
     */
    private UserManager userManager;
    private User user;
    private String province;
    private String city;
    private String county;
    private PlaceManager placeManager;
    private final String NOCHOOSE = "--请选择--";
    private static final int pageSize = 10;

    private int currentPage; // 接受传递的页码参数
    private PageResultSet<User> pageResultSet;
    private String keyWord; // 分页查询时的关键字

    private Map<String, Object> session;

    private String prePage; // 登录前要访问的页面

    // 返回的字符串提示信息
    private String returnStr;
    private String userPwd;// 密码

    private String jsonStr;// 接受从视图传过来的json字符串
    private long userId; // 用户的流水号

    private int myPageSize = 5; // 从视图中传过来的pageSize, 默认值为5

    /**
     * 修改用户密码
     * 
     * @return
     */
    public String changePwd() {
        PwdDto pwdDto = null;
        int result = -1;
        try {
            JSONObject js = JSONObject.fromObject(jsonStr);
            pwdDto = (PwdDto) JSONObject.toBean((JSONObject) js, PwdDto.class);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if (pwdDto != null) {
            try {
                result = this.userManager.doChangePwd(pwdDto.getUserId(),
                        pwdDto.getOldPwd(), pwdDto.getNewPwd());
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        Map<String, String> myMap = new HashMap<String, String>();
        myMap.put("changePwdResult", "" + result);
        JSONObject js = JSONObject.fromObject(myMap);
        this.returnStr = js.toString();
        return SUCCESS;
    }

    /**
     * 显示新增用户
     * 
     * @return
     */
    public String ajaxNewFixed() {
        try {
            this.pageResultSet = this.userManager.newAddFixed(myPageSize,
                    this.currentPage);
            Map<String, Object> myMap = new HashMap<String, Object>();
            myMap.put("currentPage", ""
                    + this.pageResultSet.getPageInfo().getCurrentPage());
            myMap.put("totalPage", ""
                    + this.pageResultSet.getPageInfo().getTotalPage());
            myMap.put("list", this.pageResultSet.getList());
            JsonConfig jsonConfig = new JsonConfig();
            jsonConfig.setExcludes(new String[] { "cars" });
            JSONObject js = JSONObject.fromObject(myMap, jsonConfig);
            returnStr = js.toString();
            // System.out.println("Info: userAction - ajaxFenyeQuery - returnStr:"
            // + returnStr);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return SUCCESS;
    }

    /**
     * 显示用户信息
     * 
     * @return
     */
    public String show() {
        try {
            this.user = this.userManager.getUserById(userId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return SUCCESS;
    }

    public String personnalInfo() {

        String strUserId = (String) session.get("userId");
        long myUserId = Long.parseLong(strUserId);
        try {
            this.user = this.userManager.getUserById(myUserId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return SUCCESS;
    }

    public String getPrePage() {
        return prePage;
    }

    public void setPrePage(String prePage) {
        this.prePage = prePage;
    }

    public String getJsonStr() {
        return jsonStr;
    }

    public void setJsonStr(String jsonStr) {
        this.jsonStr = jsonStr;
    }

    private boolean json2User() {
        boolean b = false;
        // json 反序列化
        try {
            JSONObject js = JSONObject.fromObject(jsonStr);
            user = (User) JSONObject.toBean((JSONObject) js, User.class);
            b = true;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return b;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    public String getReturnStr() {
        return returnStr;
    }

    public void setReturnStr(String returnStr) {
        this.returnStr = returnStr;
    }

    public UserAction() {
        System.out.println("userAction create....");
    }

    public UserManager getUserManager() {
        return userManager;
    }

    @Resource
    public void setUserManager(UserManager userManager) {
        this.userManager = userManager;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    /**
     * 如果已经登录,则转入到添加用户界面 否则,转入到登录界面
     * 
     * @return
     */
    public String limit() {
        return SUCCESS;
    }

    /**
     * 添加用户信息
     * 
     * @return
     */
    public String add() {
        user.getUserTypeNo().setNo(2);
        int result = userManager.add(user);
        if (result == 1) {
            return SUCCESS;
        } else {
            return ERROR;
        }
    }

    public String ajaxAdd() {
        // --------提示信息
        json2User();
        UserType userType = new UserType();
        userType.setName("普通用户");
        userType.setNo(2);
        user.setUserTypeNo(userType);

        int result = -1;
        try {
            result = userManager.add(user);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Map<String, String> myMap = new HashMap<String, String>();
        if (result == 1) {
            // 添加用户成功
            myMap.put("addUserFlag", "1");
        } else {
            // 添加用户不成功!
            myMap.put("addUserFlag", "-1");
        }
        JSONObject js = JSONObject.fromObject(myMap);
        this.returnStr = js.toString();
        return SUCCESS;
    }

    // 验证用户名是否唯一
    public String ajaxVUserAccount() {

        User u = null;
        try {
            u = this.userManager.getUserById(userId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Map<String, String> myMap = new HashMap<String, String>();

        if (u == null) {
            // 用户名验证通过
            myMap.put("vUserAccountFlag", "1");
        } else {
            // 用户名验证不通过
            myMap.put("vUserAccountFlag", "-1");
        }
        JSONObject js = JSONObject.fromObject(myMap);
        this.returnStr = js.toString();

        return SUCCESS;
    }

    // 修改用户信息
    public String ajaxUpdate() {
        // ----提示信息
        json2User();

        Map<String, String> myMap = new HashMap<String, String>();
        int result = -1;
        try {
            result = this.userManager.update(user.getId(), user);
            result = 1;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        myMap.put("updateUserFlag", "" + result);
        JSONObject js = JSONObject.fromObject(myMap);
        this.returnStr = js.toString();
        return SUCCESS;
    }

    // 根据用户账号删除用户
    public String ajaxDelete() {
        Map<String, String> myMap = new HashMap<String, String>();
        int result = -1;
        try {
            result = this.userManager.delete(userId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        myMap.put("deleteUserFlag", "" + result);
        JSONObject js = JSONObject.fromObject(myMap);
        this.returnStr = js.toString();
        return SUCCESS;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public PlaceManager getPlaceManager() {
        return placeManager;
    }

    @Resource
    public void setPlaceManager(PlaceManager placeManager) {
        this.placeManager = placeManager;
    }

    /**
     * 界面上的地点与数据库的存储之间的转换
     * 
     * @return int 地点编号
     */
    public Place dealPlace() {
        Place place = null;
        if (province.equals(this.NOCHOOSE)) {
            // 没有选择
            place = null;
        } else {
            if (city.equals(this.NOCHOOSE)) {
                // 选择了province
                place = this.placeManager.getProvince(province);
            } else {
                if (county.equals(this.NOCHOOSE)) {
                    // 选择了province和city
                    place = this.placeManager.getCity(province, city);
                } else {
                    place = this.placeManager.getCounty(province, city, county);
                    // 选择了province, city,county
                }
            }
        }
        return place;
    }

    /**
     * 对于用户的修改的处理
     * 
     * @return
     */
    public String updatecl() {
        UserType userType = this.userManager.getUserTypeByName(user
                .getUserTypeNo().getName());
        user.setUserTypeNo(userType);
        int result = this.userManager.updateByUserAccount(user.getAccount(),
                user);
        if (result == 1) {
            return SUCCESS;
        } else if (result == 0) {
            return "nouser";
        } else {
            return ERROR;
        }
    }

    /**
     * 转入update显示页面
     * 
     * @return
     */
    public String update() {
        try {
            this.user = this.userManager.getUserById(userId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return SUCCESS;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public PageResultSet<User> getPageResultSet() {
        return pageResultSet;
    }

    public void setPageResultSet(PageResultSet<User> pageResultSet) {
        this.pageResultSet = pageResultSet;
    }

    public String getKeyWord() {
        return keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }

    public String fenyeUser() {
        this.pageResultSet = this.userManager.queryByPage(5, this.currentPage);
        return SUCCESS;
    }

    // ajax分页查询
    public String ajaxQuery() {
        try {
            this.pageResultSet = this.userManager.mhQuery(keyWord, pageSize,
                    this.currentPage);
            System.out.println(this.pageResultSet);
            Map<String, Object> myMap = new HashMap<String, Object>();
            myMap.put("currentPage", ""
                    + this.pageResultSet.getPageInfo().getCurrentPage());
            myMap.put("totalPage", ""
                    + this.pageResultSet.getPageInfo().getTotalPage());
            myMap.put("list", this.pageResultSet.getList());
            JsonConfig jsonConfig = new JsonConfig();
            jsonConfig.setExcludes(new String[] { "cars" });
            JSONObject js = JSONObject.fromObject(myMap, jsonConfig);
            returnStr = js.toString();
            // System.out.println("Info: userAction - ajaxFenyeQuery - returnStr:"
            // + returnStr);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return SUCCESS;
    }

    /**
     * 对于登录表单进行处理
     * 
     * @return
     */
    public String loginFixed() {
        this.returnStr = "";
        User u = this.userManager.getUserByAccount(user.getAccount());
        if (u != null) {
            // 用户存在
            user.setPwd(MD5.getMD5(user.getPwd().getBytes()));
            if (u.getPwd().equals(user.getPwd())) {
                if (u.getUserTypeNo().getName().equals("管理员")) {
                    this.returnStr = "不是固定用户";
                    return "fail";
                } else {
                    session.put("userId", "" + u.getId());
                    session.put("userAccount", u.getAccount());
                    session.put("userTypeName", u.getUserTypeNo().getName());
                    prePage = (String) session.get("prePage");
                    session.remove("prePage");
                    if (prePage == null) {
                        return "index";
                    }
                    return SUCCESS;
                }
            } else {
                // 密码不正确
                this.returnStr = "密码不正确";
                return "fail";
            }
        } else {
            // 用户不存在
            this.returnStr = "用户不存在";
            return "fail";
        }

    }

    /**
     * 对于登录表单进行处理
     * 
     * @return
     */
    public String loginAdmin() {
        this.returnStr = "";
        User u = this.userManager.getUserByAccount(user.getAccount());
        if (u != null) {
            // 用户存在
            user.setPwd(MD5.getMD5(user.getPwd().getBytes()));
            if (u.getPwd().equals(user.getPwd())) {
                // System.out.println(">>loginCL>prePage:" + prePage);
                if (!u.getUserTypeNo().getName().equals("管理员")) {
                    this.returnStr = "不是管理员用户";
                    return "fail";
                } else {
                    // 用户登录成功
                    session.put("userId", "" + u.getId());
                    session.put("userAccount", u.getAccount());
                    session.put("userTypeName", u.getUserTypeNo().getName());
                    prePage = (String) session.get("prePage");
                    session.remove("prePage");
                    if (prePage == null) {
                        return "index";
                    }
                    return SUCCESS;
                }
            } else {
                // 密码不正确
                this.returnStr = "密码不正确";
                return "fail";
            }
        } else {
            // 用户不存在
            this.returnStr = "用户不存在";
            return "fail";
        }

    }

    /**
     * 用户退出
     * 
     * @return
     */
    public String logout() {
        try {
            session.clear();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return SUCCESS;

    }

    /**
     * adjax方式用户退出
     * 
     * @return
     */
    public String ajaxLogout() {

        Map<String, String> myMap = new HashMap<String, String>();
        try {
            session.remove("userAccount");
            session.remove("userTypeName");
            myMap.put("logoutFlag", "1");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            myMap.put("logoutFlag", "-1");
        }
        JSONObject js = JSONObject.fromObject(myMap);
        returnStr = js.toString();
        System.out.println("userAccount-ajaxQuitUser-returnStr:" + returnStr);
        return SUCCESS;
    }

    public void setSession(Map<String, Object> session) {
        // TODO Auto-generated method stub
        this.session = session;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "UserAction [currentPage=" + currentPage + ", jsonStr="
                + jsonStr + ", keyWord=" + keyWord + ", prePage=" + prePage
                + ", returnStr=" + returnStr + ", user=" + user + ", userId="
                + userId + "]";
    }

    public int getMyPageSize() {
        return myPageSize;
    }

    public void setMyPageSize(int myPageSize) {
        this.myPageSize = myPageSize;
    }

}
View Code

3.2 UserManagerImpl.java

package com.xhu.service.impl;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Component;

import com.xhu.dao.UserDao;
import com.xhu.model.PageInfo;
import com.xhu.model.PageResultSet;
import com.xhu.model.User;
import com.xhu.model.UserDetailInfo;
import com.xhu.model.UserType;
import com.xhu.service.UserManager;
import com.xhu.util.MD5;

@Component("userManager")
public class UserManagerImpl implements UserManager {
    private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    @Resource
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    /**
     * 根据用户的账号,判断用户是否存在
     * 
     * @param User
     *            user 用户的账号
     * @return boolean 如果存在,则返回true, 否则返回false
     * @author zhujinrong
     */
    public boolean exists(String userAccount) {
        return userDao.checkUserExistsWithName(userAccount);
    }

    public int add(User user) {
        user.setPwd(MD5.getMD5(user.getPwd().getBytes()));
        return this.userDao.save(user);
    }

    public void userDetailSaveOrUpdate(UserDetailInfo userDetailInfo) {
        this.userDao.userDetailSaveOrUpdate(userDetailInfo);
    }

    public int delete(long userId) {
        return this.userDao.delete(userId);
    }

    /**
     * 修改用户信息
     * 
     * @param user
     *            用户信息
     * @return void
     * @author zhujinrong
     */
    public int update(long userId, User user) {
        return this.userDao.update(userId, user);
    }

    /**
     * 返回所有用户的信息
     * 
     * @param void
     * @return List<User> 用户列表
     * @author zhujinrong
     */
    public List<User> getAllUsers() {
        // TODO Auto-generated method stub
        return userDao.getAllusers();
    }

    /**
     * 根据用户流水号,返回用户信息
     * 
     * @param int id 用户流水号
     * @return User 返回用户信息
     * @author zhujinrong
     */
    public User getUserById(long id) throws Exception {
        // TODO Auto-generated method stub
        return (User) userDao.getUserById(id);
    }

    /**
     * 根据用户的账号,返回用户的信息
     * 
     * @param String
     *            account 用户账号
     * @return User 用户
     * @author zhujinrong
     */
    public User getUserByAccount(String account) {
        // TODO Auto-generated method stub
        return (User) userDao.getUserByAccount(account);
    }

    public UserDetailInfo getUserDetailInfo(long userId) {
        // TODO Auto-generated method stub
        return this.userDao.getUserDetailInfo(userId);
    }

    public int updateUserDetail(long userId, UserDetailInfo userDetailInfo) {
        // TODO Auto-generated method stub
        return this.userDao.updateUserDetail(userId, userDetailInfo);
    }

    public int updateByUserAccount(String userAccount, User user) {
        return this.userDao.updateByUserAccount(userAccount, user);
    }

    public UserType getUserTypeByName(String userTypeName) {
        // TODO Auto-generated method stub
        return this.userDao.getUserTypeByName(userTypeName);
    }

    // 分页获取记录值
    public PageResultSet<User> queryByPage(int pageSize, int page) {
        String hql = "from User"; // 查询HQL语句
        String hql2 = "select count(*) " + hql;
        int totalRow = this.userDao.queryRowCount(hql2); // 计算总记录个数
        // System.out.println("totalRow:" + totalRow);
        PageInfo pageinfo = new PageInfo(totalRow, pageSize, page);
        // 获取该页的记录
        List<User> list = this.userDao.queryByPage(hql, pageinfo
                .getBeginIndex(), pageinfo.getPageSize());
        PageResultSet<User> pageResultSet = new PageResultSet<User>();
        pageResultSet.setList(list);
        pageResultSet.setPageInfo(pageinfo);
        return pageResultSet;
    }

    public PageResultSet<User> mhQuery(String keyWord, int pageSize, int page) {
        // TODO Auto-generated method stub
        int totalRow = this.userDao.mhQueryCount(keyWord); // 计算总记录个数
        // System.out.println("totalRow:" + totalRow);
        PageInfo pageinfo = new PageInfo(totalRow, pageSize, page);
        // 获取该页的记录
        List<User> list = null;
        if (totalRow > 0) {
            list = this.userDao.mhQuery(keyWord, pageinfo.getBeginIndex(),
                    pageinfo.getPageSize());
        }
        PageResultSet<User> pageResultSet = new PageResultSet<User>();
        pageResultSet.setList(list);
        pageResultSet.setPageInfo(pageinfo);
        return pageResultSet;
    }

    public PageResultSet<User> newAddFixed(int pageSize, int page) {
        // TODO Auto-generated method stub
        // TODO Auto-generated method stub
        int totalRow = this.userDao.newAddFixedCount(); // 计算总记录个数
        // System.out.println("totalRow:" + totalRow);
        PageInfo pageInfo = new PageInfo(totalRow, pageSize, page);
        // 获取该页的记录
        List<User> list = null;
        if (totalRow > 0) {
            list = this.userDao.newAddFixed(pageInfo.getBeginIndex(), pageInfo
                    .getPageSize());
        }
        PageResultSet<User> pageResultSet = new PageResultSet<User>();
        pageResultSet.setList(list);
        pageResultSet.setPageInfo(pageInfo);
        return pageResultSet;
    }

    public int doChangePwd(long userId, String oldPwd, String newPwd)
            throws Exception {
        // TODO Auto-generated method stub
        newPwd = MD5.getMD5(newPwd.getBytes());
        oldPwd = MD5.getMD5(oldPwd.getBytes());
        return this.userDao.changePwd(userId, oldPwd, newPwd);
    }

}
View Code

3.3 UserManager.java

package com.xhu.service;

import java.util.List;

import com.xhu.model.PageResultSet;
import com.xhu.model.User;
import com.xhu.model.UserDetailInfo;
import com.xhu.model.UserType;

public interface UserManager {

    public boolean exists(String userAccount);

    /**
     * 添加用户信息
     * 
     * @param user
     * @return int -1: 发生异常; 1: 添加用户成功
     */
    public int add(User user);

    /**
     * 添加用户相信信息
     * 
     * @param userDetailInfo
     * @return void
     * @author zhujinrong
     */
    public void userDetailSaveOrUpdate(UserDetailInfo userDetailInfo);

    /**
     * 根据用户流水号,获取用户的详细信息
     * 
     * @param userId
     * @return
     * @author zhujinrong
     */
    public UserDetailInfo getUserDetailInfo(long userId);

    /**
     * 根据用户流水号,修改用户详细信息
     * 
     * @param userId
     *            用户流水号
     * @param userDetailInfo
     *            用户详细信息
     * @return -1:发生异常; 0:用户不存在; 1:修改用户详细信息成功
     */
    public int updateUserDetail(long userId, UserDetailInfo userDetailInfo);

    /**
     * 根据用户账号,删除用户信息
     * 
     * @param userAccount
     * @return int -1: 出现异常,删除不成功 0:用户不存在 1:删除成功!
     */
    public int delete(long userId);

    /**
     * 根据用户流水号,修改用户信息
     * 
     * @param userId
     *            用户流水号
     * @param user
     *            用户信息
     * @return -1 发生异常; 0 用户不存在; 1 修改成功
     */
    public int update(long userId, User user);

    public List<User> getAllUsers();

    public User getUserById(long id) throws Exception;

    public User getUserByAccount(String account);

    /**
     * 根据用户流水号,修改用户信息
     * 
     * @param userAccount
     *            string 用户账号
     * @param user
     *            要修改的用户信息
     * @return -1:发生异常; 0: 用户不存在; 1:修改用户信息成功
     */
    public int updateByUserAccount(String userAccount, User user);

    /**
     * 根据用户类型的名称,返回用户类型对象
     * 
     * @param userTypeName
     *            String 用户类型名称
     * @return UserType 用户类型对象
     */
    public UserType getUserTypeByName(String userTypeName);

    // 分页获取记录值
    public PageResultSet<User> queryByPage(int pageSize, int page);

    /**
     * 根据要查询的信息,进行模糊查询
     * 
     * @param info
     *            要查询的关键字
     * @param pageSize
     *            页大小
     * @param page
     *            要查询的页
     * @return PageResultSet 页面信息和相关的数据
     */
    public PageResultSet<User> mhQuery(String keyWord, int pageSize, int page);

    /**
     * 新增固定用户
     * 
     * @param keyWord
     * @param pageSize
     * @param page
     * @return
     */
    public PageResultSet<User> newAddFixed(int pageSize, int page);

    /**
     * 根据userId, 将用户的密码改为newPwd
     * 
     * @param userId
     * @param oldPwd
     * @param newPwd
     * @return 1:密码修改成功 0:用户原始密码输入不正确, 修改密码不成功 -1:出错了
     * @throws Exception
     */
    public int doChangePwd(long userId, String oldPwd, String newPwd)
            throws Exception;

}
View Code

3.4 UserDaoImpl.java

package com.xhu.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;
import com.xhu.dao.UserDao;
import com.xhu.model.User;
import com.xhu.model.UserDetailInfo;
import com.xhu.model.UserType;
import com.xhu.util.MD5;

@Component("userDao")
public class UserDaoImpl implements UserDao {
    private HibernateTemplate hibernateTemplate;

    public int save(User user) {
        // TODO Auto-generated method stub
        int result = -1;
        try {
            hibernateTemplate.save(user);
            result = 1;
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return result;
    }

    public void userDetailSaveOrUpdate(UserDetailInfo userDetailInfo) {
        this.hibernateTemplate.saveOrUpdate(userDetailInfo);
    }

    @SuppressWarnings("finally")
    public int delete(long userId) {
        int result = -1;
        try {
            User user = this.hibernateTemplate.load(User.class, userId);
            if (user == null) {
                result = 0;
            }
            this.hibernateTemplate.delete(user);
            result = 1;
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println("e.getMessage:" + e.getMessage().toString());
            System.out.println("e.hashCode" + e.hashCode());
        } finally {
            return result;
        }
    }

    public int update(long userId, User user) {
        int result = -1;
        User pu = null;
        try {
            pu = this.getUserById(userId);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        // System.out.println("userDaoImpl->update:pu:" + pu);
        // System.out.println("userDaoImpl->update:user:" + user);

        if (pu == null) {
            result = 0;
            return result;
        }

        if (user.getBussinessIntro() != null) {
            pu.setBussinessIntro(user.getBussinessIntro());
        }

        if (user.getCellphone() != null) {
            pu.setCellphone(user.getCellphone());
        }

        if (user.getUserTypeNo() != null) {
            pu.setUserTypeNo(user.getUserTypeNo());
        }

        if (user.getAddress() != null) {
            pu.setAddress(user.getAddress());
        }

        if (user.getPwd() != null && !user.getPwd().trim().equals("")) {
            user.setPwd(MD5.getMD5(user.getPwd().getBytes()));
            pu.setPwd(user.getPwd());
        }

        if (user.getRealName() != null) {
            pu.setRealName(user.getRealName());
        }

        if (user.getSex() != null) {
            pu.setSex(user.getSex());
        }

        try {
            this.hibernateTemplate.update(pu);
            result = 1;
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return result;
    }

    /**
     * 根据用户的账号判断用户是否存在
     * 
     * @param account
     *            用户的账号
     * @return boolean 根据用户的账号判断用户是否存在,如果存在则返回true, 否则返回false
     * @author zhujinrong
     */
    @SuppressWarnings("unchecked")
    public boolean checkUserExistsWithName(String account) {
        boolean b = false;
        List<User> users = hibernateTemplate
                .find("from User u where u.account='" + account + "'");
        if (users != null && users.size() > 0) {
            b = true;
        }
        return b;
    }

    public HibernateTemplate getHibernateTemplate() {
        return hibernateTemplate;
    }

    @Resource
    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }

    /**
     * @author zhujinrong
     * @param
     * @return List 返回用户信息列表
     */
    @SuppressWarnings("unchecked")
    public List<User> getAllusers() {
        // TODO Auto-generated method stub
        List<User> users = (List<User>) this.hibernateTemplate
                .find("from User");
        System.out.println("users.size=" + users.size());
        return users;

    }

    /**
     * @author zhujinrong 根据用户的流水号,查找用户信息并返回
     * @param id
     *            用户的流水号
     * @return User 用户
     */
    public User getUserById(long id) throws Exception {
        // TODO Auto-generated method stub
        User user = this.hibernateTemplate.get(User.class, id);
        return user;
    }

    /**
     * @author zhujinrong 根据用户账号,查找用户并返回
     * @param account
     *            用户账号
     * @return User 用户
     */
    public User getUserByAccount(String account) {
        // TODO Auto-generated method stub

        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        session.beginTransaction();
        Query query = (Query) session.createQuery(
                "from User u where u.account = :account").setString("account",
                account);
        User user = (User) query.uniqueResult();
        session.getTransaction().commit();
        return user;
    }

    public UserDetailInfo getUserDetailInfo(long userId) {
        // TODO Auto-generated method stub
        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        session.beginTransaction();
        Query query = (Query) session.createQuery(
                "from UserDetailInfo udf where udf.user.id = :userId").setLong(
                "userId", userId);
        UserDetailInfo userDetailInfo = (UserDetailInfo) query.uniqueResult();
        session.getTransaction().commit();
        return userDetailInfo;
    }

    public int updateUserDetail(long userId, UserDetailInfo userDetailInfo) {
        // TODO Auto-generated method stub
        int result = -1;
        UserDetailInfo pudf = this.getUserDetailInfo(userId);
        if (pudf == null) {
            result = 0;
            return result;
        }
        if (userDetailInfo.getBmzw() != null) {
            pudf.setBmzw(userDetailInfo.getBmzw());
        }

        if (userDetailInfo.getCompanyName() != null) {
            pudf.setCompanyName(userDetailInfo.getCompanyName());
        }

        if (userDetailInfo.getContactAddress() != null) {
            pudf.setContactAddress(userDetailInfo.getContactAddress());
        }

        if (userDetailInfo.getFax() != null) {
            pudf.setFax(userDetailInfo.getFax());
        }

        if (userDetailInfo.getGardenName() != null) {
            pudf.setGardenName(userDetailInfo.getGardenName());
        }

        if (userDetailInfo.getLandLine() != null) {
            pudf.setLandLine(userDetailInfo.getLandLine());
        }

        if (userDetailInfo.getMsn() != null) {
            pudf.setMsn(userDetailInfo.getMsn());
        }

        if (userDetailInfo.getPostCode() != null) {
            pudf.setPostCode(userDetailInfo.getPostCode());
        }

        if (userDetailInfo.getQq() != null) {
            pudf.setQq(userDetailInfo.getQq());
        }

        try {
            this.hibernateTemplate.update(pudf);
            result = 1;
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            result = -1;
            e.printStackTrace();
        }
        return result;
    }

    public int updateByUserAccount(String userAccount, User user) {
        // TODO Auto-generated method stub
        int result = -1;
        User pu = this.getUserByAccount(userAccount);
        if (pu == null) {
            result = 0;
            return result;
        }
        System.out.println("userDaoImpl->update:pu:" + pu);
        System.out.println("userDaoImpl->update:user:" + user);

        if (pu == null) {
            result = 0;
            return result;
        }

        if (user.getBussinessIntro() != null) {
            pu.setBussinessIntro(user.getBussinessIntro());
        }

        if (user.getCellphone() != null) {
            pu.setCellphone(user.getCellphone());
        }

        if (user.getUserTypeNo() != null) {
            pu.setUserTypeNo(user.getUserTypeNo());
        }

        if (user.getAddress() != null) {
            pu.setAddress(user.getAddress());
        }

        if (user.getPwd() != null) {
            pu.setPwd(user.getPwd());
        }

        if (user.getRealName() != null) {
            pu.setRealName(user.getRealName());
        }

        if (user.getSex() != null) {
            pu.setSex(user.getSex());
        }

        try {
            this.hibernateTemplate.update(pu);
            result = 1;
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return result;

    }

    public UserType getUserTypeByName(String userTypeName) {
        // TODO Auto-generated method stub
        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        session.beginTransaction();
        Query query = (Query) session.createQuery(
                "from UserType userType where userType.name=:userTypeName")
                .setString("userTypeName", userTypeName);
        UserType userType = (UserType) query.uniqueResult();
        session.getTransaction().commit();
        return userType;
    }

    /*
     * 分页查询显示
     * 
     * @param hql查询的的hql语句
     * 
     * @param beginIndex 查询记录的起始索引位置
     * 
     * @param pageSize 一次查询记录个数
     * 
     * @return List<Teacher>
     */
    @SuppressWarnings("unchecked")
    public List<User> queryByPage(String hql, int beginIndex, int pageSize) {
        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        org.hibernate.Transaction transaction = null;
        try {
            transaction = session.beginTransaction();
            Query query = session.createQuery(hql);
            query.setFirstResult(beginIndex);
            query.setMaxResults(pageSize);
            List<User> list = query.list();
            transaction.commit();
            return list;
        } catch (Exception e) {
            if (null != transaction) {
                transaction.rollback();
                e.printStackTrace();
            }
        }
        return null;
    }

    // 查询指定HQL的结果记录总数
    public int queryRowCount(final String hql) {
        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        // System.out.println("queryRowCount->hql:" + hql);
        long result = -1;
        try {
            session.beginTransaction();
            Query query = session.createQuery(hql);
            result = (Long) query.uniqueResult(); // 计算个数
            // System.out.println("result=" + result);
            session.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (int) result;
    }

    @SuppressWarnings("unchecked")
    public List<User> mhQuery(String keyWord, int beginIndex, int pageSize) {
        // TODO Auto-generated method stub
        List<User> list = null;
        keyWord = "%" + keyWord + "%";
        try {
            Session session = this.hibernateTemplate.getSessionFactory()
                    .getCurrentSession();
            session.beginTransaction();
            Query query = session.createQuery(
                    "from User user where user.account like :keyWord "
                            + "or user.realName like :keyWord "
                            + "or user.cellphone like :keyWord").setString(
                    "keyWord", keyWord).setString("keyWord", keyWord)
                    .setString("keyWord", keyWord);

            query.setFirstResult(beginIndex);
            query.setMaxResults(pageSize);
            list = query.list();
            session.getTransaction().commit();
        } catch (HibernateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return list;
    }

    public int mhQueryCount(String keyWord) {
        // TODO Auto-generated method stub

        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        // System.out.println("queryRowCount->hql:" + hql);
        long result = -1;
        keyWord = "%" + keyWord + "%";
        System.out.println("Info: UserDaoImpl-mhQueryCount-keyWord:" + keyWord);
        try {
            session.beginTransaction();
            Query query = session.createQuery(
                    "select count(*) from User user where user.account like :keyWord "
                            + "or user.realName like :keyWord "
                            + "or user.cellphone like :keyWord").setString(
                    "keyWord", keyWord).setString("keyWord", keyWord)
                    .setString("keyWord", keyWord);
            result = (Long) query.uniqueResult(); // 计算个数
            System.out.println("result=" + result);
            session.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (int) result;
    }

    @SuppressWarnings("unchecked")
    public List<User> newAddFixed(int beginIndex, int pageSize) {
        // TODO Auto-generated method stub

        List<User> list = null;
        try {
            Session session = this.hibernateTemplate.getSessionFactory()
                    .getCurrentSession();
            session.beginTransaction();
            Query query = session
                    .createQuery(
                            "from User user where user.userTypeNo.name =:userTypeName order by user.addTime desc")
                    .setString("userTypeName", "固定用户");

            query.setFirstResult(beginIndex);
            query.setMaxResults(pageSize);
            list = (List<User>) query.list();
            session.getTransaction().commit();
        } catch (HibernateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return list;
    }

    public int newAddFixedCount() {
        Session session = this.hibernateTemplate.getSessionFactory()
                .getCurrentSession();
        // System.out.println("queryRowCount->hql:" + hql);
        long result = -1;
        try {
            session.beginTransaction();
            Query query = session
                    .createQuery(
                            "select count(*) from User user where user.userTypeNo.name=:userTypeName")
                    .setString("userTypeName", "固定用户");
            result = (Long) query.uniqueResult(); // 计算个数
            System.out.println("result=" + result);
            session.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (int) result;
    }

    public int changePwd(long userId, String oldPwd, String newPwd)
            throws Exception {
        // TODO Auto-generated method stub
        int result = -1;
        User user = this.hibernateTemplate.load(User.class, userId);
        if (user.getPwd().equals(oldPwd)) {
            user.setPwd(newPwd);
            this.hibernateTemplate.update(user);
            result = 1;
        } else {
            result = 0;
        }

        return result;
    }
}
View Code

3.5 UserDao.java

package com.xhu.dao;

import java.util.List;

import com.xhu.model.User;
import com.xhu.model.UserDetailInfo;
import com.xhu.model.UserType;

public interface UserDao {

    /**
     * 添加用户信息
     * 
     * @param user
     * @return int -1: 发生异常 1 添加用户成功
     */
    public int save(User user);

    /**
     * 删除用户信息
     * 
     * @param user
     * @return 1: 删除用户成功 0: 用户不存在 -1: exception
     */
    public int delete(long userId);

    /**
     * 根据用户流水号,修改用户信息
     * 
     * @param userId
     * @param user
     * @return -1:发生异常; 0: 用户不存在; 1:修改用户信息成功
     */
    public int update(long userId, User user);

    /**
     * 根据用户流水号,修改用户信息
     * 
     * @param userAccount
     *            string 用户账号
     * @param user
     *            要修改的用户信息
     * @return -1:发生异常; 0: 用户不存在; 1:修改用户信息成功
     */
    public int updateByUserAccount(String userAccount, User user);

    public boolean checkUserExistsWithName(String account);

    public List<User> getAllusers();

    public User getUserById(long id) throws Exception;

    public User getUserByAccount(String Account);

    public void userDetailSaveOrUpdate(UserDetailInfo userDetailInfo);

    /**
     * 根据用户流水号,获取用户的详细信息
     * 
     * @param long userId 用户流水号
     * @return UserDetailInfo 用户详细信息
     */
    public UserDetailInfo getUserDetailInfo(long userId);

    /**
     * 修改用户详细信息
     * 
     * @param userId
     *            用户流水号
     * @param userDetailInfo
     *            用户详细信息
     * @return -1: 发生异常, 修改用户信息不成功; 0: 用户不存在, 修改用户详细信息不成功, 1:修改用户成功
     * @author zhujinrong
     */
    public int updateUserDetail(long userId, UserDetailInfo userDetailInfo);

    /**
     * 根据用户类型的名称,返回用户类型对象
     * 
     * @param userTypeName
     *            String 用户类型名称
     * @return UserType 用户类型对象
     */
    public UserType getUserTypeByName(String userTypeName);

    // 分页查询显示
    public List<User> queryByPage(String hql, int beginIndex, int pageSize);

    // 查询的结果记录总数
    public int queryRowCount(final String hql);

    // 模糊查询的分页显示
    public List<User> mhQuery(String keyWord, int beginIndex, int pageSize);

    // 返回模糊查询的记录总数
    public int mhQueryCount(String keyWord);

    /**
     * 新增固定用户信息
     * 
     * @param beginIndex
     * @param pageSize
     * @return
     */
    public List<User> newAddFixed(int beginIndex, int pageSize);

    /**
     * 新增固定用户的条数
     * 
     * @return
     */
    public int newAddFixedCount();

    /**
     * 根据userId, 将用户密码:oldPwd, 改为newPwd
     * 
     * @param userId
     * @param oldPwd
     * @param newPwd
     * @return 1: 密码修改成功 0: 原始密码错误 -1:出错了
     */
    public int changePwd(long userId, String oldPwd, String newPwd)
            throws Exception;
}
View Code

3.6 model层

(1) User.java

package com.xhu.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author zhujinrong
 * 
 */
@Entity
@Table(name = "t_user")
public class User implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = -3429846500229553447L;
    private long id;
    private String account;
    private String realName;
    private String pwd;
    private String cellphone;
    private UserType userTypeNo;
    private String address;
    private String bussinessIntro;
    private String sex;
    private Date addTime = new Date();// 添加固定用户时间

    private Set<Car> cars = new HashSet<Car>();

    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

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

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getCellphone() {
        return cellphone;
    }

    public void setCellphone(String cellphone) {
        this.cellphone = cellphone;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(updatable = false)
    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    @ManyToOne
    @JoinColumn(name = "userTypeNo")
    public UserType getUserTypeNo() {
        return userTypeNo;
    }

    public void setUserTypeNo(UserType userTypeNo) {
        this.userTypeNo = userTypeNo;
    }

    public String getBussinessIntro() {
        return bussinessIntro;
    }

    public void setBussinessIntro(String bussinessIntro) {
        this.bussinessIntro = bussinessIntro;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        StringBuffer s = new StringBuffer();
        s.append("[id:" + id);
        s.append(", account:" + account);
        s.append(", realName: " + this.realName);
        s.append(", sex: " + this.sex);
        s.append(", userTypeNo:" + userTypeNo);
        s.append(", cellphone:" + this.cellphone);
        s.append(", address: " + this.address);
        s.append(", addTime: " + this.addTime);
        s.append(", bussinessIntro: " + this.bussinessIntro + "]");
        return s.toString();
    }

    @OneToMany(mappedBy = "publisher", fetch = FetchType.LAZY)
    public Set<Car> getCars() {
        return cars;
    }

    public void setCars(Set<Car> cars) {
        this.cars = cars;
    }

}
View Code

(2) UserDetail.java

package com.xhu.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "t_userDetailInfo")
public class UserDetailInfo implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = -9173252706639856987L;
    private long id; // 用户详细信息表的流水号
    private User user;// 所属用户的详细信息
    private String companyName;// 公司名称
    private String gardenName;// 所属园区
    private String contactAddress; // 联系地址
    private String postCode;// 邮政编码
    private String bmzw;// 部门职务
    private String landLine; // 固定电话
    private String fax;// 传真号
    private String qq;// qq号
    private String msn;// msn号

    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

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

    @ManyToOne
    @JoinColumn(name = "userId")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getGardenName() {
        return gardenName;
    }

    public void setGardenName(String gardenName) {
        this.gardenName = gardenName;
    }

    public String getContactAddress() {
        return contactAddress;
    }

    public void setContactAddress(String contactAddress) {
        this.contactAddress = contactAddress;
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public String getBmzw() {
        return bmzw;
    }

    public void setBmzw(String bmzw) {
        this.bmzw = bmzw;
    }

    public String getLandLine() {
        return landLine;
    }

    public void setLandLine(String landLine) {
        this.landLine = landLine;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getMsn() {
        return msn;
    }

    public void setMsn(String msn) {
        this.msn = msn;
    }

    @Override
    public String toString() {
        StringBuffer s = new StringBuffer();
        s.append("[流水号: " + this.id);
        s.append(", 用户: " + this.user);
        s.append(", 公司名称:" + this.companyName);
        s.append(", 所属园区:" + this.gardenName);
        s.append(", 联系地址: " + this.contactAddress);
        s.append(", 部门职位:" + this.bmzw);
        s.append(", 固定电话: " + this.landLine);
        s.append(", 邮政编码: " + this.postCode);
        s.append(", qq:" + this.qq);
        s.append(", msn: " + this.msn);
        s.append(", 传真:" + this.fax + "]");
        return s.toString();
    }
}
View Code

(3) UserType.java

package com.xhu.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "t_userType")
public class UserType implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = -6519396509517785002L;
    private int no;
    private String name;

    @Id
    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

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

    @Override
    public String toString() {
        StringBuffer s = new StringBuffer();
        s.append("[no: " + this.no);
        s.append(", name:" + this.name + "]");
        return s.toString();
    }
}
View Code

 3.7 UserLoginInterceptor.java

package com.xhu.interceptor;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class UserLoginInterceptor implements Interceptor {

    /**
     * 
     */
    private static final long serialVersionUID = -1098857744351094612L;

    public void destroy() {
        // TODO Auto-generated method stub
        System.out.println("...userLoginInterceptor destory />");
    }

    public void init() {
        // TODO Auto-generated method stub
        System.out.println("< userLoginInterceptor init....");
    }

    public String intercept(ActionInvocation invocation) throws Exception {
        // TODO Auto-generated method stub
        System.out.println(">>intercept.....");
        ActionContext context = invocation.getInvocationContext();

        // 获取session

        Map<String, Object> session = (Map<String, Object>) context
                .getSession();

        String userAccount = (String) session.get("userAccount");

        // 用户还未登陆

        if (userAccount == null) {

            // 获取HttpServletRequest对象

            HttpServletRequest req = ServletActionContext.getRequest();

            // 获取此请求的地址,请求地址包含application name,进行subString操作,去除application name

            String path = req.getRequestURI();

            // 获得请求中的参数

            String queryString = req.getQueryString();

            // 预防空指针

            if (queryString == null) {

                queryString = "";

            }

            // 拼凑得到登陆之前的地址

            String realPath = path + "?" + queryString;

            // 存入session,方便调用

            session.put("prePage", realPath);
            System.out.println("-----------请求地址realPath:" + realPath);

            if (realPath.startsWith("/wlphuo/admin/")) {
                return "loginAdmin";
            } else {
                return "loginFixed";
            }

        }

        // 用户已经登陆,放行
        return invocation.invoke();

    }

}
View Code

3.8 配置文件

(1) beans.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
           
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.2.xsd
           
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
           
           http://www.springframework.org/schema/tx
           http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

    <context:annotation-config/>
    <context:component-scan base-package="com.xhu"/>
    <aop:aspectj-autoproxy />
    <!-- 
     -->
    <!-- 
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
       <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
       <property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=testdb2"/>
       <property name="username" value="sa"/>
       <property name="password" value="sa"/>
    </bean>
     -->
          
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
             <property name="locations" value="classpath:jdbc.properties"/>
    </bean>
    
    <!-- datasource -->
    <bean id="dataSource" destroy-method="close"
        class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName" value="${jdbc.driverClassName}"/>
      <property name="url" value="${jdbc.url}"/>
      <property name="username" value="${jdbc.username}"/>
      <property name="password" value="${jdbc.password}"/>
      
    </bean>
    
    <!-- sessionFactory, hibernateconfig-->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <property name="packagesToScan">
    <list>
        <value>com.xhu.model</value>
    </list>
    </property>
      <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.current_session_context_class">thread</prop> 
        </props>
      </property>
    </bean>
    
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
          
    <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
          
    <!-- enable the configuration of transactional behavior based on annotations -->
    <tx:annotation-driven transaction-manager="txManager"/>
    
    <aop:config>
        <aop:pointcut id="bussinessService"
            expression="execution(public * com.xhu.service.*.*(..))" />
        <aop:advisor pointcut-ref="bussinessService"
            advice-ref="txAdvice" />
    </aop:config>
    
    <tx:advice id="txAdvice" transaction-manager="txManager">
        <tx:attributes>
            <tx:method name="exists" read-only="true" />
            <tx:method name="add*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="delete*" propagation="REQUIRED"/>
            <tx:method name="do*" propagation="REQUIRED"/>
        </tx:attributes>
    </tx:advice>
    

</beans>
View Code

(2) jdbc.properties

jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc\:sqlserver\://localhost\:1433;databaseName\=wlphuoD1
jdbc.username=sa
jdbc.password=123456
View Code

(3) log4j.properties

log4j.rootLogger=WARN,stdout
 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
View Code

(4) struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
    <constant name="struts.i18n.encoding" value="GBK"/>
    <constant name="struts.devMode" value="true" />
    
    <package name="fixed" extends="json-default">
       <interceptors>
           <!-- 定义权限控制拦截器 -->
           <interceptor name="userLogin" class="com.xhu.interceptor.UserLoginInterceptor" />
               
           <!-- 定义一个包含权限控制的拦截器栈 -->
           <interceptor-stack name="mydefault">
               <interceptor-ref name="defaultStack" />
               <interceptor-ref name="userLogin" />
           </interceptor-stack>
       </interceptors>
       
       <!-- 定义默认拦截器 -->
       <default-interceptor-ref name="mydefault" />

       <!-- 定义全局处理结果 -->
       <global-results>
           <!-- 逻辑名为login的结果,映射到/login.jsp页面 -->
           <result name="loginFixed">/login-fixed.jsp</result>
           <result name="loginAdmin">/login-admin.jsp</result>
       </global-results>
       <action name="userf-*" class="userAction" method="{1}">
               <result>/user/userf-{1}.jsp</result>
       </action>
       <!-- car受限页面 -->
       <action name="carlimitf-*" class="carAction" method="limit">
               <result>/car/carf-{1}.jsp</result>
       </action>
       
        <!-- car处理页面 -->
       <action name="carcl-*" class="carAction" method="{1}">
               <result>/car/car-{1}.jsp</result>
       </action>
       
        <!-- invoice受限页面 -->
       <action name="invoicelimitf-*" class="invoiceAction" method="limit">
               <result>/invoice/invoicef-{1}.jsp</result>
       </action>
       
       <!-- invoice处理页面 -->
       <action name="invoicecl-*" class="invoiceAction" method="{1}">
               <result>/invoice/invoice-{1}.jsp</result>
       </action>
       
       
       <!-- invoice表单提交页面 -->
       <action name="invoicetj-*" class="invoiceAction" method="{1}">
               <result >/invoice/invoice-{1}success.jsp?returnStr=${returnStr}</result>
               <result name="fail">/invoice/invoice-add.jsp?returnStr=${returnStr}</result>
       </action>
       
        <!-- 用户处理返回json -->
        <action name="user" class="userAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
        
        <!-- 车辆处理返回json -->
        <action name="car" class="carAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
         <!-- 发货单处理返回json -->
        <action name="invoice" class="invoiceAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
    </package>
    
    <package name="admin" extends="json-default">
       <interceptors>
           <!-- 定义权限控制拦截器 -->
           <interceptor name="userLogin" class="com.xhu.interceptor.UserLoginInterceptor" />
               
           <!-- 定义一个包含权限控制的拦截器栈 -->
           <interceptor-stack name="mydefault">
               <interceptor-ref name="defaultStack" />
               <interceptor-ref name="userLogin" />
           </interceptor-stack>
       </interceptors>
       
       <!-- 定义默认拦截器 -->
       <default-interceptor-ref name="mydefault" />

       <!-- 定义全局处理结果 -->
       <global-results>
           <!-- 逻辑名为login的结果,映射到/login.jsp页面 -->
           <result name="loginFixed">/login-fixed.jsp</result>
           <result name="loginAdmin">/login-admin.jsp</result>
       </global-results>
    
      
       <!-- user限制访问页面 -->
       <action name="userlimit-*" class="userAction" method="limit">
           <result>/user/user-{1}.jsp</result>
       </action>
       <action name="carlog-query" class="carLogAction" method="limit">
               <result>/car/carlog-query.jsp</result>
       </action>
       
       <action name="carlogcl-query" class="carLogAction" method="mhQuery">
               <result>/car/carlog-query.jsp?</result>
       </action>

       <!-- user处理页面 -->
       <action name="usercl-*" class="userAction" method="{1}">
           <result>/user/user-{1}.jsp</result>   
       </action>
       
       <!-- car限制访问页面 -->
       <action name="carlimit-*" class="carAction" method="limit">
           <result>/car/car-{1}.jsp</result>
       </action>
       
       <!-- car处理页面 -->
       <action name="carcl-*" class="carAction" method="{1}">
               <result>/car/car-{1}.jsp</result>
       </action>
       
       
       <!-- invoice受限页面 -->
       <action name="invoicelimit-*" class="invoiceAction" method="limit">
               <result>/invoice/invoice-{1}.jsp</result>
       </action>
       
       <!-- invoice处理页面 -->
       <action name="invoicecl-*" class="invoiceAction" method="{1}">
               <result>/invoice/invoice-{1}.jsp</result>
       </action>
       
       <!-- invoice表单提交页面 -->
       <action name="invoicetj-*" class="invoiceAction" method="{1}">
               <result >/invoice/invoice-{1}success.jsp?returnStr=${returnStr}</result>
               <result name="fail">/invoice/invoice-add.jsp?returnStr=${returnStr}</result>
       </action>
       
        
        <!-- 用户处理返回json -->
        <action name="user" class="userAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
        
        <!-- 车辆处理返回json -->
        <action name="car" class="carAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
         <!-- 发货单处理返回json -->
        <action name="invoice" class="invoiceAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
    </package>
    
    
    <package name="guest" extends="json-default">
         <action name="login-fixed" class="userAction" method="loginFixed">
            <result type="redirectAction">${prePage}</result>
            <result name="index">/index.jsp</result>
             <result name="fail">/login-fixed.jsp?returnStr=${returnStr}</result>
         </action>
         
          <action name="login-admin" class="userAction" method="loginAdmin">
            <result type="redirectAction">${prePage}</result>
            <result name="index">/index.jsp</result>
             <result name="fail">/login-admin.jsp?returnStr=${returnStr}</result>
         </action>
         <action name="logout-fixed" class="userAction" method="logout">
                <result>/index.jsp</result>
         </action>
         <action name="logout-admin" class="userAction" method="logout">
                <result>/login-admin.jsp</result>
         </action>
         
          <!-- 车辆处理返回json -->
        <action name="car" class="carAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
        
          <!-- 用户处理返回json -->
        <action name="user" class="userAction">
            <result type="json">
                <param name="root">returnStr</param>
            </result>  
        </action>
        
    </package>
</struts>
View Code

(5) 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>
  
   <!-- Bootstrap the root application context as usual using ContextLoaderListener -->
  <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      <!-- defalut:/WEB-INF/applicationContext.xml -->
  </listener>

  <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:beans.xml</param-value>
  </context-param>
  
<filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>GBK</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>  
  

    <filter>
    <filter-name>openSessionInView</filter-name>
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    <!--<init-param>
        <param-name>sessionFactoryBeanName</param-name>
        <param-value>sf</param-value>
    </init-param>
--></filter>
    
<filter-mapping>
    <filter-name>openSessionInView</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>      

<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>
View Code

3.9 jsp页面

(1) index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>物流配货网</title>
    <base href="<%=basePath %>"/>
    <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"/>
    <jsp:include page="/header.jsp"></jsp:include><!-- 包含所需要的公共头文件 -->
    <script src="js/index.js" type="text/javascript"></script> 
    <style type="text/css">
    .table{
        border-collapse:collapse;
        border: 0px;
    }
    
    .td{
        height:24px;
        border-bottom:1px dotted #B6CEFB;
        /*border:1px solid #B6CEFB;*/
    }
    
    .th
    {
        height:24px;
        /*border:1px solid #B6CEFB;*/
    }
    
    .shell{}
    #div1
    {
        height:432px;
        overflow:hidden;
    }
</style>

</head>
<body>    
<jsp:include page="head.jsp"></jsp:include>
<div id="content" style="border: 1px solid #DDDDDD;">
    <jsp:include page="/left-index.jsp"></jsp:include>
<div id="center" style="border-left: 1px solid #DDDDDD; width: 768px;">
    <div >
        <table width="100%">
            <tr>
                <td align="left" height="18px"><b>车辆信息</b></td>
                <td align="right"><a href="car/carf-find.jsp"><b>更多>></b> </a></td>
            </tr>
        </table>
        <table width="100%" bgcolor="#DOE3FC">
            <tr>
                    <th height="24px">起始地点</th> 
                    <th>到达地点</th>
                    <th>车牌号码</th>
                    <th>车辆类型</th>
                    <th>车辆长度</th>
                    <th>车辆载重</th>
                    <th>操作</th>
           </tr>
        </table>
        <div class="shell">
            <div id="div1">
                <table id="tb_cars" width="100%" class="table">
                     
                </table>
            </div>
        </div>
    </div>

</div>
</div>
<jsp:include page="tail.jsp"></jsp:include>
</body>
<script>
var c,_=Function;
with(o=document.getElementById("div1")){ innerHTML+=innerHTML; onmouseover=_("c=1"); onmouseout=_("c=0");}
(F=_("if(#%27||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%27?10:1500);".replace(/#/g,"o.scrollTop")))();
</script>
</html>
View Code

(2) head.jsp

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
    String userAccount=(String)session.getAttribute("userAccount");
    String userTypeName = (String)session.getAttribute("userTypeName");
    if (userAccount == null){
        userAccount = "";
    } 
    
    if(userTypeName == null){
        userTypeName="";
    }
%>
<table border="0" width="1024px">

<tr>
<td align="left">
<a href="index.jsp" style="text-decoration: none; color: blue;">物流配货网首页</a>
</td>
<td align="right">
欢迎您  &nbsp; &nbsp;
<a href="fixed/userf-personnalInfo" style="text-decoration: none; color: blue;">
<span id="loginUserAccount"><%=userAccount %></span></a>&nbsp;&nbsp;  
<%
    if (userAccount.equals("")){
        %>
<a href="login-fixed.jsp">登录</a>
        
        <%
    } else {
        %>
<a href="guest/logout-fixed">退出</a>        
        <%
    }
%>
<input type="hidden" id="userTypeName" value="<%=userTypeName %>" />
</td>
</tr>
</table>
<div id="topimage">
<img alt="物流配货网" src="images/wlphuo.gif" align="left">
</div>
<%
    if (userTypeName.equals("管理员")){
%>
<jsp:include page="menu-admin.jsp"></jsp:include>

<%
    }
    else {
%>
<jsp:include page="menu.jsp"></jsp:include>
<%
    }
%>
View Code

(3) left-index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<div id="left" style="width: 251px;">
    <div style="border: 1px solid #CFDEF6; margin: 6px;">
     <table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-image: url(oimages/mainnews_bg.gif); background-repeat: repeat-x;">
         <tr>
             <td align="left" height="28px">
                 <span style="color: blue;">联系我们</span>
             </td>
         </tr>
     </table>
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
          <tr>
              <td>
              <br />
              <br />
              <br />
              <font style="font-size: 18px; color: green;"> 全国客服热线: 8888-888888</font>
              <br />
              <br />
              <br />
              <br />
              </td>
          </tr>
      </table>
      </div>
     <div style="border: 1px solid #CFDEF6; margin:6px;">
     <!-- 使用工具表格 -->
     <table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-image: url(oimages/mainnews_bg.gif); background-repeat: repeat-x;">
         <tr>
             <td height="24px">
                 &nbsp;<span class="btf">实用工具</span>
             </td>
         </tr>
     </table>
     <!--本站动态开始-->
     <table width="100%" border="0" cellspacing="1" cellpadding="4">
         <tr>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.123cha.com/idcard/" target="_blank">身份证验号</a></div>
             </td>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.ip138.com:8080/search.asp" target="_blank">手机号验号</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://www.jdcsww.com/tools/other/selmile.asp" target="_blank">里程数查询</a></div>
             </td>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://www.youjia114.com/" target="_blank">全国油价查询</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.doc88.com/p-66318487172.html" target="_blank">货运车资料</a></div>
             </td>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://weather.news.sina.com.cn/" target="_blank">天气预报</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://qq.ip138.com/train/index.htm" target="_blank">列车时刻表</a></div>
             </td>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://www.ip138.com/" target="_blank">ip地址查询</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.bjjtgl.gov.cn/publish/portal0/tab65/" target="_blank">路况信息</a></div>
             </td>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://map.baidu.com/" target="_blank">电子地图</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://www.one101.com/htm/qita/ditu-china.htm" target="_blank">公路交通图</a></div>
             </td>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://www.for68.com/new/2006/1/su4518113645111160026107-0.htm" target="_blank">
                         航空货运单</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.jctrans.com/tool/zxrl.htm" target="_blank">电子日历</a></div>
             </td>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.crane88.com/nrfind.asp" target="_blank">国道查询</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://jiqiao.jxedt.com/info/3709.htm" target="_blank">各类交通标志</a></div>
             </td>
             <td bgcolor="#DOE3FC">
                 <div align="center">
                     <a href="http://hi.baidu.com/lmx%C1%D6%C3%CE%CF%A6/blog/item/b4f54eefe44275e9cf1b3e14.html"
                         target="_blank">地方汽车牌照</a></div>
             </td>
         </tr>
         <tr>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://weizhang.592163.com/" target="_blank">违章记录查询</a></div>
             </td>
             <td bgcolor="#FFFBEF">
                 <div align="center">
                     <a href="http://www.jincao.com/fa/law18.htm" target="_blank">交通法规</a></div>
             </td>
         </tr>
     </table>      
     </div>   
     <!-- 使用工具表格 -->
    </div> <!-- left -->
View Code

(4) tail.jsp

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<div style="clear:both"></div>
<div id="tailBar"></div>
<div id="tail"><a href="#">关于我们</a> | <a href="#">服务条款</a> | <a href="#">法律声明</a> | <a href="#">联系我们</a> | <a href="#">友情链接</a><br />
  物流配货网版权所有2014-2014 网址: www.logistics.com 备案号: 鲁ICP备08098373号<br />
  客服热线:0888-88888888 全国免费电话: 888-888-8888 </div>
View Code

3.10 .classpath文件

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="test"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-json-plugin-2.2.3.jar" sourcepath="C:/Users/zhujinrong/.m2/repository/org/apache/struts/struts2-json-plugin/2.2.3/struts2-json-plugin-2.2.3-sources.jar"/>
    <classpathentry kind="lib" path="E:/code-hibernate/wlphuoD1/WebRoot/WEB-INF/lib/json-lib.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aopalliance-1.0.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-commons-3.3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-tree-3.3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectj-1.7.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver-1.5.3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-nodep-2.1_3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-beanutils.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-dbcp.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.2.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-2.0.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang-2.4.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang3-3.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-pool.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ejb3-persistence.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ezmorph-1.0.4.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/freemarker-2.3.19.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-annotations.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-commons-annotations.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.11.0.GA.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/json-lib.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ognl-3.0.5.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.5.8.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aop-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aop-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aop-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aspects-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aspects-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-aspects-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-support-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-support-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context-support-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-expression-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-expression-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-expression-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-tomcat-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-tomcat-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-instrument-tomcat-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jdbc-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jdbc-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jdbc-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jms-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jms-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-jms-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-orm-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-orm-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-orm-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-oxm-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-oxm-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-oxm-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-struts-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-struts-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-struts-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-test-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-test-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-test-3.2.0.RELEASE.jar" sourcepath="C:/Users/zhujinrong/.m2/repository/org/springframework/spring-test/3.2.0.RELEASE/spring-test-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-tx-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-tx-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-tx-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-portlet-3.2.0.RELEASE-javadoc.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-portlet-3.2.0.RELEASE-sources.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-webmvc-portlet-3.2.0.RELEASE.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-core-2.3.7.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-spring-plugin-2.3.7.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xwork-core-2.3.7.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cos.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/flexjson-2.0.jar"/>
    <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.hibernate.MYECLIPSE_HIBERNATE3_3_EM"/>
    <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.hibernate.MYECLIPSE_HIBERNATE3_3_CORE"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sqljdbc4.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-log4j12-1.5.8.jar"/>
    <classpathentry kind="lib" path="E:/03jar/sqljdbc4.jar"/>
    <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
View Code

 

posted on 2014-11-25 23:10  BestNow  阅读(723)  评论(0编辑  收藏  举报

导航