package com.lab.epam.command.page.user;

import com.lab.epam.command.controller.Command;
import com.lab.epam.helper.ClassName;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Oleguk on 16.06.2015.
 */
public class EditProfileCommand implements Command {
    private static final Logger loger = LogManager.getLogger(ClassName.getCurrentClassName());

    public void execute(HttpServletRequest request,
                        HttpServletResponse response) throws ServletException, IOException {
        loger.info("Command EditProfileCommand.");
        request.getRequestDispatcher("/views/pages/editProfile.jsp").forward(request, response);
    }
}

@@ -106,24 +106,85 @@
 pam.
-helper.ClassName
+entity.*;%0Aimport com.lab.epam.helper.ClassName;%0Aimport com.lab.epam.service.*
 ;%0Aim
@@ -245,25 +245,24 @@
 g4j.Logger;%0A
-%0A
 import javax
@@ -381,16 +381,55 @@
 sponse;%0A
+import javax.servlet.http.HttpSession;%0A
 import j
@@ -447,16 +447,36 @@
 ception;
+%0Aimport java.util.*;
 %0A%0A/**%0A *
@@ -662,16 +662,98 @@
 me());%0A%0A
+    private List%3CUserImage%3E userImage = new ArrayList%3C%3E();%0A    String language;%0A%0A%0A
     publ
@@ -889,24 +889,25 @@
 ption %7B%0A
+%0A
         
 loger.in
@@ -902,48 +902,896 @@
     
-loger.info(%22Command EditProfileCommand.%22
+UserService userservice = new UserService();%0A        UserImageService userImageService = new UserImageService();%0A%0A        HttpSession session = request.getSession();%0A        String login = (String)session.getAttribute(%22login%22);%0A        ResourceBundle resourceBandle = (ResourceBundle)session.getAttribute(%22bundle%22);%0A        Locale locale = resourceBandle.getLocale();%0A        language = locale.getLanguage();%0A%0A        User user = null;%0A%0A        String page = %22/views/page/editProfile.jsp%22;%0A        loger.info(%22Login in session is %22 + login);%0A        if (login != null) %7B%0A            user = userservice.geUserByLogin(login);%0A        %7D%0A        if (user == null)%7B%0A            loger.warn(%22No user with login %22 + login);%0A        %7D%0A        if (user != null) %7B%0A%0A            userImage = userImageService.getUserImageByUserId(user.getId());%0A%0A            request.setAttribute(%22name%22, user.getName()
 );%0A 
@@ -1797,24 +1797,28 @@
         
+    
 request.
 getReque
@@ -1813,55 +1813,470 @@
 est.
-getRequestDispatcher(%22/views/pages/e
+setAttribute(%22surname%22, user.getSurname());%0A            request.setAttribute(%22login%22, user.getLogin());%0A            request.setAttribute(%22mail%22, user.getMail());%0A            request.setAttribute(%22phone%22, user.getPhone());%0A            request.setAttribute(%22about%22, user.getAbout());%0A            request.setAttribute(%22password%22, user.getPassword());%0A            request.setAttribute(%22avatar%22, user.getAvatar());%0A        %7D%0A%0A        loger.info(%22Command E
 dit
+ 
 Profile.
 jsp%22
@@ -2271,20 +2271,61 @@
 Profile.
-jsp%22
+%22);%0A        request.getRequestDispatcher(page
 ).forwar

modify editProfile Command