List of usage examples for javax.servlet.http HttpSession getAttribute
public Object getAttribute(String name);
null
if no object is bound under the name. From source file:miage.ecom.web.controller.CategoryController.java
@RequestMapping(value = "/categories", method = RequestMethod.GET) public String categories(Model model, HttpSession session) { CartBean cart;//www. j a va 2 s . c o m if (session.getAttribute("cart") == null) { cart = new CartBean(); } else { cart = (CartBean) session.getAttribute("cart"); session.setAttribute("cart", cart); } model.addAttribute("cartTotalValue", ecomBeanFrontLocal.getTotalValue(cart)); model.addAttribute("nbProducts", ecomBeanFrontLocal.getCartContents(cart).size()); List<Category> categories = categoryFacade.findAll(); model.addAttribute("categories", categories); return "categories"; }
From source file:mx.com.quadrum.contratos.controller.busquedas.ContratoBusquedaEmpleadoController.java
@RequestMapping(value = "buscarPorTipoDeContratoEmpleado/{idTipoContrato}", method = RequestMethod.GET) public ModelAndView buscarPorTipoDeContratoEmpleado(@PathVariable("idTipoContrato") Integer idTipoContrato, ModelMap model, HttpSession session) { if (session.getAttribute(USUARIO) == null && session.getAttribute(CLIENTE) == null) { return new ModelAndView("templates/index"); }//w w w . ja v a2s. c o m Usuario usuario = (Usuario) session.getAttribute(USUARIO); List<Contrato> contratos = busquedasContratos.buscarPorTipoDeContratoEmpleado((idTipoContrato), usuario.getId()); model.put("contratos", contratos); return new ModelAndView("usuario/contratoAux", model); }
From source file:springku.BelajarController.java
@RequestMapping(value = "/simpan") public String simpan(@ModelAttribute("hallo") Hallo h, ModelMap map, HttpServletRequest request) { HttpSession session = request.getSession(); map.addAttribute("pesan", session.getAttribute("username")); return "learning"; }
From source file:br.com.arduinoweb.controller.ArduinoController.java
@RequestMapping("actions/ArduinoExecuta") public String ArduinoExecuta(Command command, HttpSession session) throws IOException { if (session.getAttribute("conexao").equals("btn-success")) { command = new CommandService().getCommandById(command.getCommandId()); new ArduinoService(session).ArduinoExecuta(command.getCommand()); User user = (User) session.getAttribute("usuarioLogado"); new LogService().SaveLog(new Log(command, user)); }/* ww w. j a v a 2s . c o m*/ return "redirect:/Home"; }
From source file:com.linecorp.sample.login.core.application.controller.WebController.java
/** * <p>LINE Login Button Page//from w w w. j a va 2 s .co m * <p>Login Type is to log in on any desktop or mobile website * https://developers.line.me/web-login/overview#login_flow_type_web */ @RequestMapping("/") public String login(HttpSession httpSession) { if (httpSession.getAttribute(ACCESS_TOKEN) == null) { return "user/login"; } else { return "redirect:" + "profile"; } }
From source file:cz.muni.fi.pa165.mvc.controllers.LoginController.java
@RequestMapping(value = "/logout", method = RequestMethod.POST) public String logout(HttpServletRequest request, Model model, RedirectAttributes redirectAttributes, UriComponentsBuilder uriBuilder) { HttpSession session = request.getSession(false); if (session.getAttribute("authenticatedUser") != null) { session.invalidate();//from w ww. j ava 2 s. c o m } redirectAttributes.addFlashAttribute("alert_success", "You were successfully logouted"); return "redirect:" + uriBuilder.path("/").toUriString(); }
From source file:de.berlios.jhelpdesk.web.preferences.DisplayListsEditController.java
@RequestMapping(value = "/preferences/displayLists.html", method = RequestMethod.GET) public String prepareForm(@ModelAttribute("dlPrefs") DisplayListsPreferences preferences, HttpSession session, ModelMap map) {//from w w w .j a v a2 s . c om User currentUser = (User) session.getAttribute("user"); DisplayListsPreferences dlPreferences = currentUser.getDlPreferences(); map.addAttribute("dlPrefs", dlPreferences != null ? dlPreferences : new DisplayListsPreferences()); return "preferences/displayLists"; }
From source file:mx.com.quadrum.contratos.controller.busquedas.ContratoBusquedaEmpleadoController.java
@RequestMapping(value = "buscarPorContactoEmpleado/{nombre}/{paterno}/{materno}", method = RequestMethod.GET) public ModelAndView buscarPorContactoEmpleado(@PathVariable("nombre") String nombre, @PathVariable("paterno") String paterno, @PathVariable("materno") String materno, ModelMap model, HttpSession session) { if (session.getAttribute(USUARIO) == null && session.getAttribute(CLIENTE) == null) { return new ModelAndView("templates/index"); }/*www. j a v a2s . co m*/ Usuario usuario = (Usuario) session.getAttribute(USUARIO); List<Contrato> contratos = busquedasContratos.buscarPorContacoEmpleado(nombre, paterno, materno, usuario.getId()); model.put("contratos", contratos); return new ModelAndView("usuario/contratoAux", model); }
From source file:util.EgovWebSocketMessengerController.java
/** * ?(? ) ??.//from w w w . j av a2s.com * @param session ? * @param model ? * @return view name */ @RequestMapping(value = "/cop/msg/websocketMessengerMain.do") public String websocketMessengerMain(HttpSession session, ModelMap model) { model.addAttribute("loginVO", session.getAttribute("loginVO")); return "egovframework/com/ext/msg/EgovMessengerMain"; }
From source file:com.naver.timetable.controller.UserController.java
@RequestMapping(value = "/edit") public ModelAndView edit(HttpServletRequest request, User user, String passwd) { userBO.editUser(user);/*from w w w. java 2 s . c o m*/ LoginInfo loginInfo = new LoginInfo(); loginInfo.setEmail(user.getEmail()); loginInfo.setPasswd(passwd); if (!passwd.equals("")) { userBO.changePasswd(loginInfo); } HttpSession session = request.getSession(); String targetPage = session.getAttribute("targetPage") == null ? "/lecture/index" : (String) session.getAttribute("targetPage"); return new ModelAndView(new StringBuilder("redirect:").append(targetPage).toString()); }