Struts2.3.4.1 + Spring3.1.2 + Hibernate4.1.6整合
1. Jar包
2. web.xml配置
3. struts.xml配置
4. hibernate.cfg.xml配置
5. applicationContext.xml配置
6. log4j.properties配置
7. Dao层
8. Service层
9. Action层
1. Jar包
1) Struts 2.3.4.1
下载地址:http://struts.apache.org/download
3. struts.xml配置
5. applicationContext.xml配置
6. log4j.properties配置public class LoginAction extends ActionBase {private static final long serialVersionUID = 1L;private String username;private String password;private UserService userService;public void setUserService(UserService userService) {this.userService = userService;}public String login() throws Exception {User user = new User(username, password);User login = userService.login(user);if (login != null) {session.put("user", login);return SUCCESS;}return INPUT;}public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}
相关Jar包下载如下: