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.ProfileForm;
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-11-2006
22   * 
23   * XDoclet definition:
24   * @struts.action validate="true"
25   * @struts.action-forward name="ok" path="/user/topicList.jsp"
26   */
27  public class ProfileAction extends ActionSupport {
28  
29  	/*** 
30  	 * Method execute
31  	 * @param mapping
32  	 * @param form
33  	 * @param request
34  	 * @param response
35  	 * @return ActionForward
36  	 */
37  	public ActionForward execute(ActionMapping mapping, ActionForm form,
38  			HttpServletRequest request, HttpServletResponse response) {
39  		UserDao userDao =  (UserDao) this.getWebApplicationContext().getBean("userDao");
40  		ProfileForm profileForm = (ProfileForm)form; 
41  		User user = userDao.getUserById(profileForm.getId());
42  		user.setFirstname(profileForm.getFirstName());
43  		user.setLastname(profileForm.getLastName());
44  		user.setEmail(profileForm.getEmail());
45  		userDao.saveUser(user);
46  		return mapping.findForward("ok");
47  	}
48  }