Subversion Repositories WebE

Rev

Rev 20 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

1
package ch.ffhs.webE.web;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import ch.ffhs.webE.dao.UserDAO;
import ch.ffhs.webE.dao.UserDAOImpl;

import ch.ffhs.webE.domain.User;

public class UserAction extends ActionSupport implements ModelDriven<User> {

        private static final long serialVersionUID = -6659925652584240539L;

        private User user = new User();
        private List<User> userList = new ArrayList<User>();
        private UserDAO userDAO = new UserDAOImpl();
       
        @Override
        public User getModel() {
                return user;
        }
       
        public String add()
        {
                userDAO.saveUser(user);
                return SUCCESS;
        }
       
        public String list()
        {
                userList = userDAO.listUser();
                return SUCCESS;
        }
               
        public User getUser() {
                return user;
        }

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

        public List<User> getUserList() {
                return userList;
        }

        public void setUserList(List<User> userList) {
                this.userList = userList;
        }

}