Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.uds.sauvage.controller; import com.uds.sauvage.service.iService.ISurveyService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * * @author yirou */ @Controller public class WelcomeController { @Autowired private ISurveyService surveyService; @RequestMapping(value = "/", method = RequestMethod.GET) public String listAll(Model model, HttpServletRequest req) { System.out.println("Je passe la"); req.setAttribute("base_url", req.getContextPath()); model.addAttribute("surveys", surveyService.getAll()); model.addAttribute("page", "welcome.jsp"); System.out.println("passage " + req.getContextPath()); return "index"; } }