所需架包
aopalliance.jar
asm-1.5.3.jar
aspectjrt.jar
aspectjweaver.jar
c3p0-0.9.1.jar
cglib-2.1_3.jar
com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
com.springsource.org.apache.commons.logging-1.1.1.jar
com.springsource.org.apache.commons.pool-1.5.3.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.15.jar
junit-3.8.1.jar
log4j-1.2.15.jar
mybatis-3.0.3-SNAPSHOT.jar
mybatis-3.0.4.jar
mybatis-spring-1.0.0-RC2.jar
ognl-2.7.3.jar
ojdbc14.jar
org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.test-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
slf4j-api-1.5.10.jar
slf4j-log4j12-1.5.10.jar
spring-beans-3.0.4.RELEASE.jar
spring-core-3.0.4.RELEASE.jar
spring-jdbc-3.0.4.RELEASE.jar
spring-tx-3.0.4.RELEASE.jar
struts2-convention-plugin-2.1.8.1.jar
struts2-core-2.1.8.1.jar
struts2-spring-plugin-2.1.8.1.jar
struts-getterAndSetter-plugin.jar
xwork-core-2.1.6.jar


对应的配置文件
applicationContext.xml:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd"
default-autowire="byName" default-lazy-init="true">






classpath:com/medbri/mss/config/jdbc.properties










































advice-ref="txAdvice" />













struts.xml

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">






value="medbri-default" />



value="com.medbri.mss" />









/common/sucess.jsp
/common/error.jsp





mybatis-config.xml











代码
action
@Results({
@Result(name = "userListWindow", type = UserAction.DISPATHCER, location = "/userList.jsp"),
@Result(name = "userUpdateWindow", type = UserAction.DISPATHCER, location = "/updateUser.jsp")
})
public class UserAction extends BaseAction {
@Autowired
private IUserService userService;
private Users users;

public Users getUsers() {
return users;
}

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

/**
*
*/
private static final long serialVersionUID = 1L;

/**
* 用户添加
*
* @return 返回转向信息
* @throws Exception
*             采用struts2异常处理抛出所有异常
*/
public String addUser() throws Exception {
userService.addUser(users);
getRequest().setAttribute("url","user!queryPageUser.action");
return "suc";

}


/**
* 用户修改
*
* @return 返回转向信息
* @throws Exception
*             采用struts2异常处理抛出所有异常
*/
public String updateUser() throws Exception {
userService.updateUser(users);
getRequest().setAttribute("url","user!queryPageUser.action");
return "suc";

}

/**
* 用户删除
*
* @return 返回转向信息
* @throws Exception
*             采用struts2异常处理抛出所有异常
*/
public String deleteUser() throws Exception {
userService.deleteUser(id);
getRequest().setAttribute("url","user!queryPageUser.action");
return "suc";
}

/**
* 用户修改查询
*
* @return 返回转向信息
* @throws Exception
*             采用struts2异常处理抛出所有异常
*/
public String findById() throws Exception {
users= userService.findById(id);
return "userUpdateWindow";
}

/**
* 用户分页查询
*
* @return 返回转向信息
* @throws Exception
*             采用struts2异常处理抛出所有异常
*/
public String queryPageUser() throws Exception {
pagenation= userService.queryPage(pageNum,PAGE_SIZE);
return "userListWindow";
}

}


dao
public interface IUsers {
/**
* 添加用户
*
* @param users
*            用户model
*/
public void addUser(Users users);

/**
* 删除用户
*
* @param userId
*            用户id
*/
public void deleteUser(Long userId);

/**
* 分页时获取总记录数
* @param map 查询条件
* @return 返回总记录数
*/
public int getCount(Map map);

/**
* 用户分页查询
* @param map 查询条件
* @return 返回用户列表
*/
public List queryPage(Map map);

/**
* 修改用户信息
* @param users
*/
    public void updateUser(Users users);
   
    /**
     * 根据id查找用户
     * @param id 用户id
     * @return 返回指定用户
     */
    public Users findById(Long id);
}

mybatis配置文件










insert into users values(seq_user_id.nextval,#{userName},#{userPassword})



delete from users where userId=#{userId}


update users set userName=#{userName},userPassword=#{userPassword} where
userId=#{userId}
   








service

service接口省略(版面有限)

@Service
public class UserServiceImpl implements IUserService {
@Autowired
private IUsers iUsers;

/**
* 用户管理添加
*
* @param users
*            用户实体
*/
public void addUser(Users users) {
iUsers.addUser(users);
}

/**
* 删除用户
*
* @param userId
*            用户id
*/
public void deleteUser(Long userId) {
iUsers.deleteUser(userId);
}

/**
* 分页时获取总记录数
* @param map 查询条件
* @return 返回总记录数
*/
public int getCount(Map map){
return iUsers.getCount(map);
}

/**
* 用户分页查询
* @param map 查询条件
* @return 返回用户列表
*/
public  Pagenation queryPage(int pageNum,int pageSize){
Map map=new HashMap();
int count=iUsers.getCount(map);
Pagenation p = new Pagenation(pageSize,pageNum, count);
map.put("startRow",p.getStartRow());
map.put("pageSize",pageSize);
Listlist=iUsers.queryPage(map);
p.setList(list);
return p;
}

/**
* 修改用户信息
* @param users
*/
    public void updateUser(Users users){
    iUsers.updateUser(users);
    }
   
    /**
     * 根据id查找用户
     * @param id 用户id
     * @return 返回指定用户
     */
    public Users findById(Long id){
    return iUsers.findById(id);
    }

}