View Javadoc

1   /*
2    * Generated by MyEclipse Struts
3    * Template path: templates/java/JavaClass.vtl
4    */
5   package hu.elte.tribus.action;
6   
7   import hu.elte.tribus.form.RegistrationForm;
8   import hu.elte.tribus.interfaces.UserDao;
9   import hu.elte.tribus.model.User;
10  
11  import javax.servlet.http.HttpServletRequest;
12  import javax.servlet.http.HttpServletResponse;
13  
14  import org.apache.struts.action.ActionForm;
15  import org.apache.struts.action.ActionForward;
16  import org.apache.struts.action.ActionMapping;
17  import org.springframework.web.struts.ActionSupport;
18  
19  /*** 
20   * MyEclipse Struts
21   * Creation date: 11-10-2006
22   * 
23   * XDoclet definition:
24   * @struts.action validate="true"
25   */
26  public class RegistrationAction extends ActionSupport {
27  	/*
28  	 * Generated Methods
29  	 */
30  
31  	/*** 
32  	 * Method execute
33  	 * @param mapping
34  	 * @param form
35  	 * @param request
36  	 * @param response
37  	 * @return ActionForward
38  	 */
39  	public ActionForward execute(ActionMapping mapping, ActionForm form,
40  			HttpServletRequest request, HttpServletResponse response) {
41  		RegistrationForm registrationForm = (RegistrationForm)form;
42  		UserDao userDao = (UserDao) getWebApplicationContext().getBean("userDao");
43  		// save
44  		User user = new User();
45  		user.setUsername(registrationForm.getUserName());
46  		user.setLastname(registrationForm.getLastName());
47  		user.setFirstname(registrationForm.getFirstName());
48  		user.setPasswd(registrationForm.getPassword());
49  		user.setEmail(registrationForm.getEmail());
50  		user.setStatus(User.ENUM_STATUS_REG_REQUESTED);
51  		userDao.saveUser(user);
52  		return mapping.findForward("ok");
53  	}
54  }