/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package web.users;
import domain.Message;
import domain.editors.Editor;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import web.generic.GenericCommandController;
/**
* Контроллер выводит информацию, что запись на прием прошла успешно
* @author vip
*/
public class ViewMessageController extends GenericCommandController {
protected static final Logger log = Logger.getLogger(ViewMessageController.class);
public ViewMessageController() {
setCommandClass(MessageDTO.class);
}
@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
binder.registerCustomEditor(Message.class, new Editor(getDao(), Message.class));
}
@Override
protected ModelAndView handle(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors) throws Exception {
MessageDTO dto = (MessageDTO) command;
HashMap model = new HashMap();
model.put("command", dto);
return new ModelAndView("users/viewmessage", model);
}
}